Index: DamClients/DamUI/trunk/src/Dam/Tests/StiImporter/SoilProfile2DImporterTest.cs =================================================================== diff -u -r3021 -r3036 --- DamClients/DamUI/trunk/src/Dam/Tests/StiImporter/SoilProfile2DImporterTest.cs (.../SoilProfile2DImporterTest.cs) (revision 3021) +++ DamClients/DamUI/trunk/src/Dam/Tests/StiImporter/SoilProfile2DImporterTest.cs (.../SoilProfile2DImporterTest.cs) (revision 3036) @@ -1,4 +1,25 @@ -using System; +// Copyright (C) Stichting Deltares 2020. All rights reserved. +// +// This file is part of the application DAM - UI. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; using System.Collections.Generic; using System.Linq; using Deltares.Dam.Data; @@ -67,10 +88,12 @@ public void Import_WithValidArguments_ReturnsExpectedSoilProfiles() { // Setup + const string profileOneName = "SimpleProfile"; + const string profileTwoName = "Tutorial-1a 10.1.4.3"; Segment segment = CreateSegmentWithProfiles(new[] { - "SimpleProfile.sti", - "Tutorial-1a 10.1.4.3.sti" + $"{profileOneName}.sti", + $"{profileTwoName}.sti" }); SoilList availableSoils = CreateSoilList(new[] { @@ -87,14 +110,17 @@ // Assert Assert.That(soilProfiles, Has.Count.EqualTo(2)); + SoilProfile2D soilProfileOne = soilProfiles.ElementAt(0); + Assert.That(soilProfileOne.Name, Is.EqualTo(profileOneName)); CollectionAssert.AreEqual(new[] { "Soft Clay", "Muck" }, soilProfileOne.Surfaces.Select(s => s.Name)); SoilProfile2D soilProfileTwo = soilProfiles.ElementAt(1); + Assert.That(soilProfileTwo.Name, Is.EqualTo(profileTwoName)); CollectionAssert.AreEquivalent(new[] { "Soft Clay", @@ -111,9 +137,10 @@ LogManager.Messages.Clear(); // Clear all messages as it is a singleton const string invalidSoilProfile = "Tutorial-1a 10.1.4.3.sti"; // Soil profile also contains peat and sand for its layers + const string profileName = "SimpleProfile"; Segment segment = CreateSegmentWithProfiles(new[] { - "SimpleProfile.sti", + $"{profileName}.sti", invalidSoilProfile }); SoilList availableSoils = CreateSoilList(new[] @@ -129,7 +156,9 @@ // Assert Assert.That(soilProfiles, Has.Count.EqualTo(1)); + SoilProfile2D soilProfileOne = soilProfiles.ElementAt(0); + Assert.That(soilProfileOne.Name, Is.EqualTo(profileName)); CollectionAssert.AreEqual(new[] { "Soft Clay", @@ -157,11 +186,11 @@ // Setup LogManager.Messages.Clear(); // Clear all messages as it is a singleton - const string invalidSoilProfile = "NonExistentSoilProfile"; + const string profileName = "SimpleProfile"; Segment segment = CreateSegmentWithProfiles(new[] { - "SimpleProfile.sti", - invalidSoilProfile + $"{profileName}.sti", + "NonExistentSoilProfile" }); SoilList availableSoils = CreateSoilList(new[] { @@ -176,7 +205,9 @@ // Assert Assert.That(soilProfiles, Has.Count.EqualTo(1)); + SoilProfile2D soilProfileOne = soilProfiles.ElementAt(0); + Assert.That(soilProfileOne.Name, Is.EqualTo(profileName)); CollectionAssert.AreEqual(new[] { "Soft Clay", Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/StiImporter/SoilProfile2DImporter.cs =================================================================== diff -u -r3016 -r3036 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/StiImporter/SoilProfile2DImporter.cs (.../SoilProfile2DImporter.cs) (revision 3016) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/StiImporter/SoilProfile2DImporter.cs (.../SoilProfile2DImporter.cs) (revision 3036) @@ -1,4 +1,25 @@ -using System; +// Copyright (C) Stichting Deltares 2020. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; using System.Collections.Generic; using System.IO; using System.Linq; Index: DamClients/DamUI/trunk/src/Dam/Tests/StiImporter/StiFileReaderTest.cs =================================================================== diff -u -r3032 -r3036 --- DamClients/DamUI/trunk/src/Dam/Tests/StiImporter/StiFileReaderTest.cs (.../StiFileReaderTest.cs) (revision 3032) +++ DamClients/DamUI/trunk/src/Dam/Tests/StiImporter/StiFileReaderTest.cs (.../StiFileReaderTest.cs) (revision 3036) @@ -93,7 +93,8 @@ public void ReadSoilProfile_WithValidFile_ReturnsExpectedSoilProfile() { // Setup - string filePath = Path.Combine(TestDataFolder, "SimpleProfile.sti"); + var soilProfileName = "SimpleProfile"; + string filePath = Path.Combine(TestDataFolder, $"{soilProfileName}.sti"); var reader = new StiFileReader(); @@ -102,6 +103,7 @@ // Assert Assert.That(soilProfile, Is.Not.Null); + Assert.That(soilProfile.Name, Is.EqualTo(soilProfileName)); Assert.That(soilProfile.Surfaces.Count, Is.EqualTo(2)); var topLeftPoint = new GeometryPoint(0, 0, -4); Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/StiImporter/StiFileReader.cs =================================================================== diff -u -r3017 -r3036 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/StiImporter/StiFileReader.cs (.../StiFileReader.cs) (revision 3017) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/StiImporter/StiFileReader.cs (.../StiFileReader.cs) (revision 3036) @@ -1,4 +1,26 @@ -using System; +// Copyright (C) Stichting Deltares 2020. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.IO; using System.Linq; using Deltares.Geotechnics.IO.Importers; using Deltares.Geotechnics.Soils; @@ -39,7 +61,10 @@ try { var soilProfileImporter = new SoilProfile2DFromDSerieFileImporter(); - return soilProfileImporter.ConvertToSoilProfile2D(filePath); + SoilProfile2D soilProfile = soilProfileImporter.ConvertToSoilProfile2D(filePath); + soilProfile.Name = Path.GetFileNameWithoutExtension(filePath); + + return soilProfile; } catch (Exception e) {