// 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 Deltares.Dam.Data; namespace Deltares.Dam.Tests { using System.Collections.Generic; using System.Linq; using NUnit.Framework; using Deltares.Dam.Data.DataPlugins; using Deltares.Geotechnics.IO; using Deltares.Dam.Data.DataPlugins.Configuration; [TestFixture] public class DataPluginImporterMGeobaseTests { const string MGeobaseDatabase = @"..\..\..\..\..\data\Dam\Waterboards\Groot Salland\Binnenwaarts\Vb.mdb"; List srcMGBDataSources; DataPluginImporter dataMGBPluginImporter; [SetUp] public void TestFixtureSetup() { srcMGBDataSources = new List(); srcMGBDataSources.Add(new DataSource() { DataSourceType = DataSourceType.MGeobase, DataLocation = MGeobaseDatabase }); dataMGBPluginImporter = new DataPluginImporter(); dataMGBPluginImporter.SetDataSources("", srcMGBDataSources); } [Test] public void CanRetrieveSoilMaterials() { const string soilKleiDuin = "Clay, clean, stiff"; // Check if soil materials available string dikeRingId = "AutoCreate"; var dikeRingIds = new List {dikeRingId}; dataMGBPluginImporter.ImportDataForDikeRings(dikeRingIds, null); IEnumerable soil1DIdList = dataMGBPluginImporter.GetSoilIdList(dikeRingId); Assert.AreEqual(27, soil1DIdList.Count()); IEnumerable soilDetails = dataMGBPluginImporter.GetSoilDetails(dikeRingId, soilKleiDuin); Assert.IsTrue(soilDetails.Count() > 0); Assert.AreEqual("-6168145", soilDetails.Where(x => x.ParameterName.Equals(SoilParameterNames.Color)).FirstOrDefault().ParameterValue); Assert.AreEqual("0.001", soilDetails.Where(x => x.ParameterName.Equals(SoilParameterNames.PermeabKx)).FirstOrDefault().ParameterValue); Assert.AreEqual("20", soilDetails.Where(x => x.ParameterName.Equals(SoilParameterNames.AbovePhreaticLevel)).FirstOrDefault().ParameterValue); Assert.AreEqual("20", soilDetails.Where(x => x.ParameterName.Equals(SoilParameterNames.BelowPhreaticLevel)).FirstOrDefault().ParameterValue); } [Test] public void CanRetrieveProfiles() { string dikeRingId = "AutoCreate"; var dikeRingIds = new List { dikeRingId }; dataMGBPluginImporter.ImportDataForDikeRings(dikeRingIds, null); IEnumerable soilProfileIdList = dataMGBPluginImporter.GetSoilProfile1DIdList(dikeRingId); Assert.AreEqual(3, soilProfileIdList.Count()); DpSoilProfile soilProfile = dataMGBPluginImporter.GetSoilProfile1DDetails(dikeRingId, soilProfileIdList.ElementAt(0)); Assert.AreEqual(17, soilProfile.Layers.Count); DpLayer layer = soilProfile.Layers[0]; Assert.AreEqual(5.11, layer.TopLevel); Assert.AreEqual("Loam, ve san, stiff", layer.SoilName); } } }