Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.StixFileReader.Tests/Deltares.Dam.StixFileReader.Tests.csproj =================================================================== diff -u --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.StixFileReader.Tests/Deltares.Dam.StixFileReader.Tests.csproj (revision 0) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.StixFileReader.Tests/Deltares.Dam.StixFileReader.Tests.csproj (revision 4247) @@ -0,0 +1,25 @@ + + + + + + + + ..\..\..\lib\DSL-Geo\Deltares.Geotechnics.dll + + + ..\..\..\lib\DamEngine\DGeoSuite.Common.dll + + + ..\..\..\lib\DamEngine\DGeoSuite.Components.Persistence.dll + + + + + PreserveNewest + + + PreserveNewest + + + Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.StixFileReader/StixFileReader.cs =================================================================== diff -u --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.StixFileReader/StixFileReader.cs (revision 0) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.StixFileReader/StixFileReader.cs (revision 4247) @@ -0,0 +1,64 @@ +// Copyright (C) Stichting Deltares 2023. 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.IO; +using Components.Persistence.Stability.Version2; +using Components.Persistence.Stability.Version2.Data; +using Deltares.Geotechnics.Soils; +using DGeoSuite.Components.Persistence; + +namespace Deltares.Dam.StixFileReader; + +/// +/// Read data from a stix file. +/// +public class StixFileReader +{ + /// + /// Reads the data from a stix file into a . + /// + /// The file path to read from. + /// A . + /// This only reads the names and the geometry of the soil layers. + public SoilProfile2D ReadSoilProfile(string filePath) + { + if (!File.Exists(filePath)) + { + throw new FileNotFoundException($"Could not find file {filePath}."); + } + + using Reader dataModelReader = new PersistenceFactory().CreateArchiveReader(filePath); + PersistableDataModel dataModel = dataModelReader.Read(); + VerifyReadData(dataModel); + + SoilProfile2D soilProfile2D = new SoilProfile2DDataModel().ConvertToSoilProfile2D(dataModel); + soilProfile2D.Name = Path.GetFileName(Path.GetFileNameWithoutExtension(filePath)); + return soilProfile2D; + } + + private static void VerifyReadData(PersistableDataModel dataModel) + { + if (dataModel.Info == null) + { + throw new StorageReadException($"Could not successfully read {typeof(PersistableDataModel)} from file."); + } + } +} \ No newline at end of file Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.StixFileReader.Tests/StixFileReaderTest.cs =================================================================== diff -u --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.StixFileReader.Tests/StixFileReaderTest.cs (revision 0) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.StixFileReader.Tests/StixFileReaderTest.cs (revision 4247) @@ -0,0 +1,55 @@ +// Copyright (C) Stichting Deltares 2023. 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.IO; +using Deltares.Geotechnics.Soils; +using DGeoSuite.Components.Persistence; +using NUnit.Framework; + +namespace Deltares.Dam.StixFileReader.Tests; + +[TestFixture] +public class StixFileReaderTest +{ + [Test] + public void WhenNonExistingFileIsRead_ThenFileNotFoundExceptionIsThrown() + { + Assert.That(() => new StixFileReader().ReadSoilProfile("nonExistingFile.stix"), + Throws.Exception.TypeOf().With.Message.Contains("Could not find file nonExistingFile.stix.")); + } + + [Test] + public void WhenEmptyArchiveIsRead_ThenStorageReadExceptionIsThrown() + { + Assert.That(() => new StixFileReader().ReadSoilProfile(@".\TestFiles\Corrupt.stix"), Throws.Exception.TypeOf()); + } + + [Test] + public void WhenStixFileIsRead_ThenSoilProfile2DIsNotNull() + { + const string fileName = @".\TestFiles\DWP_1.stix"; + + SoilProfile2D soilProfile2D = new StixFileReader().ReadSoilProfile(fileName); + + Assert.That(soilProfile2D, Is.Not.Null); + Assert.That(soilProfile2D.Name, Is.EqualTo("DWP_1")); + } +} \ No newline at end of file Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.StixFileReader.Tests/TestFiles/Corrupt.stix =================================================================== diff -u Binary files differ Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.StixFileReader/SoilProfile2DDataModel.cs =================================================================== diff -u --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.StixFileReader/SoilProfile2DDataModel.cs (revision 0) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.StixFileReader/SoilProfile2DDataModel.cs (revision 4247) @@ -0,0 +1,186 @@ +// Copyright (C) Stichting Deltares 2023. 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.Drawing; +using System.Linq; +using Components.Persistence.Stability.Version2.Data; +using Deltares.Geometry; +using Deltares.Geotechnics.Soils; + +namespace Deltares.Dam.StixFileReader; + +public class SoilProfile2DDataModel +{ + public SoilProfile2D ConvertToSoilProfile2D(PersistableDataModel dataModel) + { + string geometryId = dataModel.Scenarios.Last().Stages.Last().GeometryId; + PersistableGeometry geometry = dataModel.Geometry.First(g => g.Id == geometryId); + + var soilProfile2D = new SoilProfile2D(); + + var xMin = double.MaxValue; + var xMax = double.MinValue; + var zMin = double.MaxValue; + var zMax = double.MinValue; + foreach (PersistableLayer layer in geometry.Layers) + { + CreateCurvesFromLayer(layer, soilProfile2D.Geometry.Curves); + CreateSurfacesFromLayer(layer, soilProfile2D.Geometry.Surfaces); + foreach (PersistablePoint point in layer.Points) + { + xMin = Math.Min(xMin, point.X); + xMax = Math.Max(xMax, point.X); + zMin = Math.Min(zMin, point.Z); + zMax = Math.Max(zMax, point.Z); + if (!IsPointPresent(point, soilProfile2D.Geometry.Points)) + { + soilProfile2D.Geometry.Points.Add(new GeometryPoint(point.X, 0, point.Z)); + } + } + + PersistableSoil persistableSoil = FetchSoilProperties(layer.Id, dataModel); + + var soilLayer2D = new SoilLayer2D + { + Soil = new Soil + { + Name = persistableSoil.Name, + Color = FetchSoilColor(persistableSoil, dataModel) + } + }; + soilProfile2D.Surfaces.Add(soilLayer2D); + } + + soilProfile2D.Geometry.Left = xMin; + soilProfile2D.Geometry.Right = xMax; + soilProfile2D.Geometry.Bottom = zMin; + soilProfile2D.YEnd = zMin; + return soilProfile2D; + } + + private Color FetchSoilColor(PersistableSoil persistableSoil, PersistableDataModel dataModel) + { + var color = new Color(); + + foreach (PersistableSoilVisualization soilVisualization in dataModel.SoilVisualizations.SoilVisualizations) + { + if (soilVisualization.SoilId == persistableSoil.Id) + { + color = soilVisualization.Color; + } + } + + return color; + } + + private PersistableSoil FetchSoilProperties(string layerId, PersistableDataModel dataModel) + { + var soilId = string.Empty; + + foreach (PersistableSoilLayerCollection soilLayer in dataModel.SoilLayers) + { + foreach (PersistableSoilLayer s in soilLayer.SoilLayers) + { + if (s.LayerId == layerId) + { + soilId = s.SoilId; + } + } + } + + return soilId == string.Empty ? null : dataModel.Soils.Soils.FirstOrDefault(soil => soil.Id == soilId); + } + + private void CreateSurfacesFromLayer(PersistableLayer layer, ICollection geometrySurface) + { + var surface = new GeometrySurface(); + for (var i = 0; i < layer.Points.Count(); i++) + { + surface.OuterLoop.Points.Add(new GeometryPoint(layer.Points.ElementAt(i).X, 0, layer.Points.ElementAt(i).Z)); + surface.Name = layer.Label; + } + + //To Do: Add inner loops + geometrySurface.Add(surface); + } + + private void CreateCurvesFromLayer(PersistableLayer layer, ICollection geometryCurves) + { + for (var i = 0; i < layer.Points.Count(); i++) + { + GeometryCurve curve; + if (i == layer.Points.Count() - 1) + { + curve = CreateCurve(layer.Points.ElementAt(i), layer.Points.ElementAt(0)); + } + else + { + curve = CreateCurve(layer.Points.ElementAt(i), layer.Points.ElementAt(i + 1)); + } + + if (!IsCurvePresent(curve, geometryCurves)) + { + geometryCurves.Add(curve); + } + } + } + + private GeometryCurve CreateCurve(PersistablePoint firstPoint, PersistablePoint secondPoint) + { + return new GeometryCurve + { + HeadPoint = new GeometryPoint(firstPoint.X, 0, firstPoint.Z), + EndPoint = new GeometryPoint(secondPoint.X, 0, secondPoint.Z) + }; + } + + private bool IsCurvePresent(GeometryCurve curve, IEnumerable geometryCurves) + { + return geometryCurves.Any(geometryCurve => + (ArePointsEqual(geometryCurve.HeadPoint, curve.HeadPoint) && + ArePointsEqual(geometryCurve.EndPoint, curve.EndPoint)) || + (ArePointsEqual(geometryCurve.EndPoint, curve.HeadPoint) && + ArePointsEqual(geometryCurve.HeadPoint, curve.EndPoint))); + } + + private bool IsPointPresent(PersistablePoint point, IEnumerable geometryPoints) + { + return geometryPoints.Any(geometryPoint => ArePointsEqual(geometryPoint, point)); + } + + private bool ArePointsEqual(GeometryPoint firstPoint, GeometryPoint secondPoint) + { + const double pointTolerance = 1E-6; + + return (Math.Abs(firstPoint.X - secondPoint.X) < pointTolerance) && + (Math.Abs(firstPoint.Z - secondPoint.Z) < pointTolerance); + } + + private bool ArePointsEqual(GeometryPoint firstPoint, PersistablePoint secondPoint) + { + const double pointTolerance = 1E-6; + + return (Math.Abs(firstPoint.X - secondPoint.X) < pointTolerance) && + (Math.Abs(firstPoint.Z - secondPoint.Z) < pointTolerance); + } +} \ No newline at end of file Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.StixFileReader/StixFileReadException.cs =================================================================== diff -u --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.StixFileReader/StixFileReadException.cs (revision 0) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.StixFileReader/StixFileReadException.cs (revision 4247) @@ -0,0 +1,67 @@ +// Copyright (C) Stichting Deltares 2023. 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.Runtime.Serialization; + +namespace Deltares.Dam.Data.StiImporter; + +/// +/// Exception thrown when reading a stix file went wrong. +/// +[Serializable] +public class StixFileReadException : Exception +{ + /// + /// Initializes a new instance of the class. + /// + public StixFileReadException() {} + + /// + /// Initializes a new instance of the class + /// with a specified error message. + /// + /// The message that describes the error. + public StixFileReadException(string message) + : base(message) {} + + /// + /// Initializes a new instance of the class with a specified error message + /// and a reference to the inner exception that is the cause of this exception. + /// + /// The error message that explains the reason for the exception. + /// The exception that is the cause of the current exception, + /// or null if no inner exception is specified. + public StixFileReadException(string message, Exception innerException) : base(message, innerException) {} + + /// + /// Initializes a new instance of with + /// serialized data. + /// The that holds the serialized + /// object data about the exception being thrown. + /// The that contains contextual + /// information about the source or destination. + /// The parameter is + /// null. + /// The class name is null or + /// is zero (0). + protected StixFileReadException(SerializationInfo info, StreamingContext context) : base(info, context) {} +} \ No newline at end of file Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DamProject.cs =================================================================== diff -u -r4236 -r4247 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DamProject.cs (.../DamProject.cs) (revision 4236) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DamProject.cs (.../DamProject.cs) (revision 4247) @@ -290,7 +290,6 @@ ProjectFileName = fileName; DataEventPublisher.InvokeWithoutPublishingEvents(() => { - string damProjectFolder = Path.GetDirectoryName(fileName); var xmlSerializer = new XmlDeserializer(); object project = xmlSerializer.XmlDeserialize(fileName, typeof(DamProjectData), new DefaultClassFactory()); Index: DamClients/DamUI/trunk/src/Dam.sln =================================================================== diff -u -r4074 -r4247 --- DamClients/DamUI/trunk/src/Dam.sln (.../Dam.sln) (revision 4074) +++ DamClients/DamUI/trunk/src/Dam.sln (.../Dam.sln) (revision 4247) @@ -42,6 +42,10 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Deltares.Dam.TestHelper", "Dam\Deltares.Dam.TestHelper\Deltares.Dam.TestHelper.csproj", "{4250BDBE-1131-4C42-89FC-6BE73972313C}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Deltares.Dam.StixFileReader", "DamClientsLibrary\Deltares.Dam.StixFileReader\Deltares.Dam.StixFileReader.csproj", "{BDCF58D4-BB13-4A61-BFE8-5FF6768154C6}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Deltares.Dam.StixFileReader.Tests", "DamClientsLibrary\Deltares.Dam.StixFileReader.Tests\Deltares.Dam.StixFileReader.Tests.csproj", "{3751DDD3-7BBC-4918-BC12-BB4082F6C6D8}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x86 = Debug|x86 @@ -98,6 +102,14 @@ {4250BDBE-1131-4C42-89FC-6BE73972313C}.Debug|x86.Build.0 = Debug|x86 {4250BDBE-1131-4C42-89FC-6BE73972313C}.Release|x86.ActiveCfg = Release|x86 {4250BDBE-1131-4C42-89FC-6BE73972313C}.Release|x86.Build.0 = Release|x86 + {BDCF58D4-BB13-4A61-BFE8-5FF6768154C6}.Debug|x86.ActiveCfg = Debug|x86 + {BDCF58D4-BB13-4A61-BFE8-5FF6768154C6}.Debug|x86.Build.0 = Debug|x86 + {BDCF58D4-BB13-4A61-BFE8-5FF6768154C6}.Release|x86.ActiveCfg = Release|x86 + {BDCF58D4-BB13-4A61-BFE8-5FF6768154C6}.Release|x86.Build.0 = Release|x86 + {3751DDD3-7BBC-4918-BC12-BB4082F6C6D8}.Debug|x86.ActiveCfg = Debug|Any CPU + {3751DDD3-7BBC-4918-BC12-BB4082F6C6D8}.Debug|x86.Build.0 = Debug|Any CPU + {3751DDD3-7BBC-4918-BC12-BB4082F6C6D8}.Release|x86.ActiveCfg = Release|Any CPU + {3751DDD3-7BBC-4918-BC12-BB4082F6C6D8}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.StixFileReader.Tests/TestFiles/DWP_1.stix =================================================================== diff -u Binary files differ Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.StixFileReader/Deltares.Dam.StixFileReader.csproj =================================================================== diff -u --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.StixFileReader/Deltares.Dam.StixFileReader.csproj (revision 0) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.StixFileReader/Deltares.Dam.StixFileReader.csproj (revision 4247) @@ -0,0 +1,30 @@ + + + + + <_Parameter1>Deltares.Dam.StixFileReader.Tests + + + + + ..\..\..\lib\DamEngine\Components.Persistence.Stability.Version2.dll + + + ..\..\..\lib\DSL-Geo\Deltares.Geometry.dll + + + ..\..\..\lib\DSL-Geo\Deltares.Geotechnics.dll + + + ..\..\..\lib\DSL-Core\Deltares.Standard.dll + + + ..\..\..\lib\DamEngine\DGeoSuite.Components.Persistence.dll + + + + + + + + \ No newline at end of file Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.StixFileReader/StixFileReaderHelper.cs =================================================================== diff -u --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.StixFileReader/StixFileReaderHelper.cs (revision 0) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.StixFileReader/StixFileReaderHelper.cs (revision 4247) @@ -0,0 +1,47 @@ +// Copyright (C) Stichting Deltares 2023. 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.IO; + +namespace Deltares.Dam.StixFileReader; + +/// +/// Helper class for . +/// +public abstract class StixFileReaderHelper +{ + private const string stixFileExtension = ".stix"; + + /// + /// Returns the file name including the stix file extension/>. + /// + /// The file name. + public static string FetchFileNameWithStixExtension(string fileName) + { + return HasStixFileExtension(fileName) ? fileName : fileName + stixFileExtension; + } + + internal static bool HasStixFileExtension(string fileName) + { + return string.Equals(Path.GetExtension(fileName), stixFileExtension, StringComparison.CurrentCultureIgnoreCase); + } +} \ No newline at end of file Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Deltares.Dam.Data.csproj =================================================================== diff -u -r4216 -r4247 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Deltares.Dam.Data.csproj (.../Deltares.Dam.Data.csproj) (revision 4216) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Deltares.Dam.Data.csproj (.../Deltares.Dam.Data.csproj) (revision 4247) @@ -112,6 +112,7 @@ + Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.StixFileReader.Tests/StixFileReaderHelperTest.cs =================================================================== diff -u --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.StixFileReader.Tests/StixFileReaderHelperTest.cs (revision 0) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.StixFileReader.Tests/StixFileReaderHelperTest.cs (revision 4247) @@ -0,0 +1,47 @@ +// Copyright (C) Stichting Deltares 2023. 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 NUnit.Framework; + +namespace Deltares.Dam.StixFileReader.Tests +{ + [TestFixture] + public class StixFileReaderHelperTest + { + [Test] + [TestCase("profileName.stix")] + [TestCase("profileName")] + public void FetchSoilProfileFileNameWithStixExtensionTest(string profileName) + { + Assert.That(StixFileReaderHelper.FetchFileNameWithStixExtension(profileName), Is.EqualTo("profileName.stix")); + } + + [Test] + [TestCase("profileName.stix", true)] + [TestCase("profileName.sti", false)] + [TestCase("../src/DamClientsLibrary/profileName.STIX", true)] + [TestCase("profileName", false)] + public void HasStixFileExtensionTest(string profileName, bool expectedResult) + { + Assert.That(StixFileReaderHelper.HasStixFileExtension(profileName), Is.EqualTo(expectedResult)); + } + } +} \ No newline at end of file