public void ReadStochasticSoilModel_ModelWithStochasticProfilesWith2DProfiles_ReturnsModelWithStochasticProfiles() { // Setup string dbFile = Path.Combine(testDataPath, "modelWithStochasticSoilProfile2D.soil"); using (var reader = new StochasticSoilModelReader(dbFile)) { reader.Validate(); // Call StochasticSoilModel model = reader.ReadStochasticSoilModel(); // Assert Assert.AreEqual("SoilModel", model.Name); Assert.AreEqual(FailureMechanismType.Stability, model.FailureMechanismType); CollectionAssert.AreEqual(new[] { 0.15, 0.175, 0.075, 0.05, 0.05, 0.15, 0.175, 0.075, 0.05, 0.05 }.OrderBy(p => p), model.StochasticSoilProfiles.Select(profile => profile.Probability)); CollectionAssert.AllItemsAreInstancesOfType(model.StochasticSoilProfiles.Select(profile => profile.SoilProfile), typeof(SoilProfile2D)); } Assert.IsTrue(TestHelper.CanOpenFileForWrite(dbFile)); }
public void Transform_ValidStochasticSoilModelWithSameProfileInTwoStochasticSoilProfiles_ReturnsExpectedMacroStabilityInwardsStochasticSoilModel(ISoilProfile soilProfile) { // Setup const string soilModelName = "name"; const double originalProfileOneProbability = 0.2; const double originalProfileTwoProbability = 0.7; StochasticSoilModel soilModel = MacroStabilityInwardsStochasticSoilModelTestFactory.CreateMacroStabilityInwardsStochasticSoilModelWithGeometry(soilModelName, new[] { new StochasticSoilProfile(originalProfileOneProbability, soilProfile), new StochasticSoilProfile(originalProfileTwoProbability, soilProfile) }); var transformer = new MacroStabilityInwardsStochasticSoilModelTransformer(); MacroStabilityInwardsStochasticSoilModel transformed = null; // Call Action call = () => transformed = transformer.Transform(soilModel); // Assert string expectedMessage = $"Ondergrondschematisatie '{soilProfile.Name}' is meerdere keren gevonden in ondergrondmodel '{soilModelName}'. " + "Kansen van voorkomen worden opgeteld."; TestHelper.AssertLogMessageWithLevelIsGenerated(call, Tuple.Create(expectedMessage, LogLevelConstant.Warn)); MacroStabilityInwardsStochasticSoilProfile[] transformedStochasticSoilProfiles = transformed.StochasticSoilProfiles.ToArray(); Assert.AreEqual(1, transformedStochasticSoilProfiles.Length); const double expectedProbability = originalProfileOneProbability + originalProfileTwoProbability; Assert.AreEqual(expectedProbability, transformedStochasticSoilProfiles[0].Probability, 1e-6); }
public MacroStabilityInwardsStochasticSoilModel Transform(StochasticSoilModel stochasticSoilModel) { if (stochasticSoilModel == null) { throw new ArgumentNullException(nameof(stochasticSoilModel)); } if (stochasticSoilModel.FailureMechanismType != FailureMechanismType.Stability) { string message = string.Format(RiskeerCommonIOResources.IStochasticSoilModelTransformer_Cannot_transform_FailureMechanismType_0_Only_FailureMechanismType_1_supported, stochasticSoilModel.FailureMechanismType, FailureMechanismType.Stability); throw new ImportedDataTransformException(message); } try { MacroStabilityInwardsStochasticSoilProfile[] stochasticSoilProfiles = TransformStochasticSoilProfiles(stochasticSoilModel.StochasticSoilProfiles, stochasticSoilModel.Name).ToArray(); return(new MacroStabilityInwardsStochasticSoilModel(stochasticSoilModel.Name, stochasticSoilModel.Geometry, stochasticSoilProfiles)); } catch (ArgumentException e) { throw new ImportedDataTransformException(e.Message, e); } }
public bool IsValidForFailureMechanism(StochasticSoilModel stochasticSoilModel) { if (stochasticSoilModel == null) { throw new ArgumentNullException(nameof(stochasticSoilModel)); } return(stochasticSoilModel.FailureMechanismType == FailureMechanismType.Stability); }
public void IsValidForFailureMechanism_ValidStochasticSoilModelType_ReturnsFalse() { // Setup var filter = new MacroStabilityInwardsStochasticSoilModelFilter(); var model = new StochasticSoilModel(nameof(FailureMechanismType.Stability), FailureMechanismType.Stability); // Call bool isValid = filter.IsValidForFailureMechanism(model); // Assert Assert.IsTrue(isValid); }
public void Transform_ValidStochasticSoilModelWithSoilProfile2D_ReturnsExpectedMacroStabilityInwardsStochasticSoilModel() { // Setup var random = new Random(21); double probability = random.NextDouble(); var transformer = new MacroStabilityInwardsStochasticSoilModelTransformer(); StochasticSoilModel soilModel = MacroStabilityInwardsStochasticSoilModelTestFactory.CreateMacroStabilityInwardsStochasticSoilModelWithGeometry("some name", new[] { new StochasticSoilProfile(probability, new SoilProfile2D(2, "test", new[] { SoilLayer2DTestFactory.CreateSoilLayer2D() }, Enumerable.Empty <PreconsolidationStress>())) }); // Call MacroStabilityInwardsStochasticSoilModel transformedModel = transformer.Transform(soilModel); // Assert Assert.AreEqual(soilModel.Name, transformedModel.Name); CollectionAssert.AreEqual(soilModel.Geometry, transformedModel.Geometry); Assert.AreEqual(1, transformedModel.StochasticSoilProfiles.Count()); var expectedStochasticSoilProfile = new MacroStabilityInwardsStochasticSoilProfile(probability, new MacroStabilityInwardsSoilProfile2D("test", new[] { new MacroStabilityInwardsSoilLayer2D(new Ring(new[] { new Point2D(1.0, 1.0), new Point2D(2.0, 1.0) }), new MacroStabilityInwardsSoilLayerData { UsePop = true }, new[] { new MacroStabilityInwardsSoilLayer2D(new Ring(new[] { new Point2D(0.0, 0.0), new Point2D(1.0, 0.0) }), new MacroStabilityInwardsSoilLayerData { UsePop = true }, Enumerable.Empty <MacroStabilityInwardsSoilLayer2D>()) }) }, Enumerable.Empty <MacroStabilityInwardsPreconsolidationStress>())); AssertStochasticSoilProfile(expectedStochasticSoilProfile, transformedModel.StochasticSoilProfiles.First()); }
public void Constructor_Always_ExpectedValues() { // Setup const string name = "some name"; var failureMechanismType = new Random(145).NextEnumValue <FailureMechanismType>(); // Call var stochasticSoilModel = new StochasticSoilModel(name, failureMechanismType); // Assert Assert.AreEqual(name, stochasticSoilModel.Name); Assert.AreEqual(failureMechanismType, stochasticSoilModel.FailureMechanismType); CollectionAssert.IsEmpty(stochasticSoilModel.Geometry); CollectionAssert.IsEmpty(stochasticSoilModel.StochasticSoilProfiles); }
public void Transform_InvalidFailureMechanismType_ThrowsImportedDataTransformException(FailureMechanismType failureMechanismType) { // Setup var transformer = new PipingStochasticSoilModelTransformer(); var soilModel = new StochasticSoilModel("some name", failureMechanismType); // Call TestDelegate test = () => transformer.Transform(soilModel); // Assert var exception = Assert.Throws <ImportedDataTransformException>(test); Assert.AreEqual($"Het stochastische ondergrondmodel met '{failureMechanismType}' als faalmechanisme type is niet ondersteund. " + "Alleen stochastische ondergrondmodellen met 'Piping' als faalmechanisme type zijn ondersteund.", exception.Message); }
public void Transform_ValidStochasticSoilModelWithSoilProfile2D_ReturnsExpectedPipingStochasticSoilModel() { // Setup var random = new Random(21); const string name = "name"; const double intersectionX = 1.0; SoilLayer2D layer = SoilLayer2DTestFactory.CreateSoilLayer2D(); var profile = new SoilProfile2D(0, "SoilProfile2D", new[] { layer }, Enumerable.Empty <PreconsolidationStress>()) { IntersectionX = intersectionX }; var transformer = new PipingStochasticSoilModelTransformer(); double probability = random.NextDouble(); var soilModel = new StochasticSoilModel(name, FailureMechanismType.Piping) { StochasticSoilProfiles = { new StochasticSoilProfile(probability, profile) }, Geometry = { new Point2D(1.0, 0.0), new Point2D(0.0, 0.0) } }; // Call PipingStochasticSoilModel transformed = transformer.Transform(soilModel); // Assert Assert.AreEqual(name, transformed.Name); Assert.AreEqual(1, transformed.StochasticSoilProfiles.Count()); CollectionAssert.AreEqual(soilModel.Geometry, transformed.Geometry); var expectedPipingSoilProfile = new[] { new PipingStochasticSoilProfile(probability, PipingSoilProfileTransformer.Transform(profile)) }; AssertPipingStochasticSoilProfiles(expectedPipingSoilProfile, transformed.StochasticSoilProfiles.ToArray()); }
/// <summary> /// Creates a <see cref="StochasticSoilModel"/> with a predefined geometry. /// </summary> /// <param name="soilModelName">The name of the stochastic soil model.</param> /// <param name="failureMechanismType">The failure mechanism type of the stochastic soil model.</param> /// <param name="stochasticSoilProfiles">The stochastic soil profiles belonging to the soil model.</param> /// <returns>A configured <see cref="StochasticSoilModel"/> with a predefined geometry.</returns> /// <exception cref="ArgumentNullException">Throw when <paramref name="soilModelName"/> or /// <paramref name="stochasticSoilProfiles"/> is <c>null</c>.</exception> public static StochasticSoilModel CreateStochasticSoilModelWithGeometry(string soilModelName, FailureMechanismType failureMechanismType, IEnumerable <StochasticSoilProfile> stochasticSoilProfiles) { var model = new StochasticSoilModel(soilModelName, failureMechanismType) { Geometry = { new Point2D(1, 2), new Point2D(3, 4) } }; model.StochasticSoilProfiles.AddRange(stochasticSoilProfiles); return(model); }
public void Transform_StochasticSoilModelWithInvalidSoilProfile_ThrowsImportedDataTransformException() { // Setup var transformer = new PipingStochasticSoilModelTransformer(); StochasticSoilModel soilModel = PipingStochasticSoilModelTestFactory.CreatePipingStochasticSoilModelWithGeometry(new[] { StochasticSoilProfileTestFactory.CreateStochasticSoilProfileWithValidProbability(new TestSoilProfile()) }); // Call TestDelegate test = () => transformer.Transform(soilModel); // Assert var exception = Assert.Throws <ImportedDataTransformException>(test); const string message = "De ondergrondschematisatie van het type 'TestSoilProfile' is niet ondersteund. " + "Alleen ondergrondschematisaties van het type 'SoilProfile1D' of 'SoilProfile2D' zijn ondersteund."; Assert.AreEqual(message, exception.Message); }
public void Transform_InvalidStochasticSoilModel_ThrowsImportedDataTransformException() { // Setup var stochasticSoilModel = new StochasticSoilModel("name", FailureMechanismType.Piping); var transformer = new PipingStochasticSoilModelTransformer(); // Call TestDelegate test = () => transformer.Transform(stochasticSoilModel); // Assert var exception = Assert.Throws <ImportedDataTransformException>(test); Exception innerException = exception.InnerException; Assert.IsNotNull(innerException); Assert.IsInstanceOf <ArgumentException>(innerException); Assert.AreEqual(innerException.Message, exception.Message); }
public void Transform_ValidStochasticSoilModelWithSameProfileInTwoStochasticSoilProfiles_ReturnsExpectedPipingStochasticSoilModel() { // Setup const string soilModelName = "name"; const string soilProfileName = "SoilProfile"; const double intersectionX = 1.0; SoilLayer2D layer = SoilLayer2DTestFactory.CreateSoilLayer2D(); var profile = new SoilProfile2D(0, soilProfileName, new[] { layer }, Enumerable.Empty <PreconsolidationStress>()) { IntersectionX = intersectionX }; const double originalProfileOneProbability = 0.2; const double originalProfileTwoProbability = 0.7; StochasticSoilModel soilModel = PipingStochasticSoilModelTestFactory.CreatePipingStochasticSoilModelWithGeometry(soilModelName, new[] { new StochasticSoilProfile(originalProfileOneProbability, profile), new StochasticSoilProfile(originalProfileTwoProbability, profile) }); var transformer = new PipingStochasticSoilModelTransformer(); PipingStochasticSoilModel transformed = null; // Call Action call = () => transformed = transformer.Transform(soilModel); // Assert string expectedMessage = $"Ondergrondschematisatie '{soilProfileName}' is meerdere keren gevonden in ondergrondmodel '{soilModelName}'. " + "Kansen van voorkomen worden opgeteld."; TestHelper.AssertLogMessageWithLevelIsGenerated(call, Tuple.Create(expectedMessage, LogLevelConstant.Warn)); PipingStochasticSoilProfile[] transformedStochasticSoilProfiles = transformed.StochasticSoilProfiles.ToArray(); Assert.AreEqual(1, transformedStochasticSoilProfiles.Length); const double expectedProbability = originalProfileOneProbability + originalProfileTwoProbability; Assert.AreEqual(expectedProbability, transformedStochasticSoilProfiles[0].Probability, 1e-6); }
public void ReadStochasticSoilModel_SoilModelWithoutStochasticSoilProfiles_ReturnsSoilModelWithoutLayers() { // Setup string dbFile = Path.Combine(testDataPath, "modelWithoutStochasticSoilProfiles.soil"); using (var reader = new StochasticSoilModelReader(dbFile)) { reader.Validate(); // Call StochasticSoilModel model = reader.ReadStochasticSoilModel(); // Assert Assert.AreEqual("SoilModel", model.Name); Assert.AreEqual(FailureMechanismType.Piping, model.FailureMechanismType); CollectionAssert.IsEmpty(model.StochasticSoilProfiles); } Assert.IsTrue(TestHelper.CanOpenFileForWrite(dbFile)); }
public void ReadStochasticSoilModel_EmptyDatabase_ReturnsNull() { // Setup string dbFile = Path.Combine(testDataPath, "emptySchema.soil"); using (var reader = new StochasticSoilModelReader(dbFile)) { reader.Validate(); int nrOfModels = reader.StochasticSoilModelCount; // Call StochasticSoilModel model = reader.ReadStochasticSoilModel(); // Assert Assert.IsNull(model); Assert.AreEqual(0, nrOfModels); } Assert.IsTrue(TestHelper.CanOpenFileForWrite(dbFile)); }
public void Transform_ValidStochasticSoilModelWithStochasticProfileInvalidProbability_ThrowsImportedDataException(StochasticSoilProfile profile) { // Setup StochasticSoilModel soilModel = PipingStochasticSoilModelTestFactory.CreatePipingStochasticSoilModelWithGeometry(new[] { profile }); var transformer = new PipingStochasticSoilModelTransformer(); // Call TestDelegate call = () => transformer.Transform(soilModel); // Assert var exception = Assert.Throws <ImportedDataTransformException>(call); const string expectedMessage = "Het aandeel van de ondergrondschematisatie in het stochastische ondergrondmodel " + "moet in het bereik [0,0, 1,0] liggen."; StringAssert.StartsWith(expectedMessage, exception.Message); }
public void Transform_ValidStochasticSoilModelWithSoilProfile1D_ReturnsExpectedMacroStabilityInwardsStochasticSoilModel() { // Setup var random = new Random(21); double probability = random.NextDouble(); const double top = 4; var transformer = new MacroStabilityInwardsStochasticSoilModelTransformer(); StochasticSoilModel soilModel = MacroStabilityInwardsStochasticSoilModelTestFactory.CreateMacroStabilityInwardsStochasticSoilModelWithGeometry("some name", new[] { new StochasticSoilProfile(probability, new SoilProfile1D(2, "test", 3, new[] { SoilLayer1DTestFactory.CreateSoilLayer1DWithValidAquifer(top) })) }); // Call MacroStabilityInwardsStochasticSoilModel transformedModel = transformer.Transform(soilModel); // Assert Assert.AreEqual(soilModel.Name, transformedModel.Name); CollectionAssert.AreEqual(soilModel.Geometry, transformedModel.Geometry); Assert.AreEqual(1, transformedModel.StochasticSoilProfiles.Count()); var expectedStochasticSoilProfile = new MacroStabilityInwardsStochasticSoilProfile(probability, new MacroStabilityInwardsSoilProfile1D("test", 3, new[] { new MacroStabilityInwardsSoilLayer1D(top) { Data = { UsePop = true, ShearStrengthModel = MacroStabilityInwardsShearStrengthModel.CPhi, IsAquifer = false } } })); AssertStochasticSoilProfile(expectedStochasticSoilProfile, transformedModel.StochasticSoilProfiles.First()); }
public void Transform_ValidTwoStochasticSoilModelWithSameProfile_ReturnsExpectedPipingStochasticSoilModel() { // Setup const double intersectionX = 1.0; SoilLayer2D layer = SoilLayer2DTestFactory.CreateSoilLayer2D(); var profile = new SoilProfile2D(0, "SoilProfile2D", new[] { layer }, Enumerable.Empty <PreconsolidationStress>()) { IntersectionX = intersectionX }; var transformer = new PipingStochasticSoilModelTransformer(); StochasticSoilModel soilModel1 = PipingStochasticSoilModelTestFactory.CreatePipingStochasticSoilModelWithGeometry(new[] { StochasticSoilProfileTestFactory.CreateStochasticSoilProfileWithValidProbability(profile) }); StochasticSoilModel soilModel2 = PipingStochasticSoilModelTestFactory.CreatePipingStochasticSoilModelWithGeometry(new[] { StochasticSoilProfileTestFactory.CreateStochasticSoilProfileWithValidProbability(profile) }); // Call PipingStochasticSoilModel transformed1 = transformer.Transform(soilModel1); PipingStochasticSoilModel transformed2 = transformer.Transform(soilModel2); // Assert PipingStochasticSoilProfile[] transformedStochasticSoilProfiles1 = transformed1.StochasticSoilProfiles.ToArray(); PipingStochasticSoilProfile[] transformedStochasticSoilProfiles2 = transformed2.StochasticSoilProfiles.ToArray(); Assert.AreEqual(1, transformedStochasticSoilProfiles1.Length); Assert.AreEqual(1, transformedStochasticSoilProfiles2.Length); PipingStochasticSoilProfile pipingStochasticSoilProfile1 = transformedStochasticSoilProfiles1[0]; PipingStochasticSoilProfile pipingStochasticSoilProfile2 = transformedStochasticSoilProfiles2[0]; Assert.AreSame(pipingStochasticSoilProfile1.SoilProfile, pipingStochasticSoilProfile2.SoilProfile); }
public void Transform_ValidStochasticSoilModelWithSameProfileInTwoStochasticSoilProfilesAndSumOfProbabilitiesInvalid_ThrowsImportedDataException(ISoilProfile soilProfile) { // Setup var stochasticSoilProfiles = new[] { new StochasticSoilProfile(0.9, soilProfile), new StochasticSoilProfile(0.9, soilProfile) }; StochasticSoilModel soilModel = MacroStabilityInwardsStochasticSoilModelTestFactory.CreateMacroStabilityInwardsStochasticSoilModelWithGeometry(stochasticSoilProfiles); var transformer = new MacroStabilityInwardsStochasticSoilModelTransformer(); // Call TestDelegate call = () => transformer.Transform(soilModel); // Assert var exception = Assert.Throws <ImportedDataTransformException>(call); const string expectedMessage = "Het aandeel van de ondergrondschematisatie in het stochastische ondergrondmodel " + "moet in het bereik [0,0, 1,0] liggen."; StringAssert.StartsWith(expectedMessage, exception.Message); }
public void Transform_ValidStochasticSoilModelWithSimilarProfileInTwoStochasticSoilProfiles_ReturnsExpectedPipingStochasticSoilModel() { // Setup var random = new Random(21); const string soilProfileName = "SoilProfile"; const double intersectionX = 1.0; var soilProfile2D = new SoilProfile2D(0, soilProfileName, new[] { SoilLayer2DTestFactory.CreateSoilLayer2D() }, Enumerable.Empty <PreconsolidationStress>()) { IntersectionX = intersectionX }; var stochasticSoilProfile2D = new StochasticSoilProfile(random.NextDouble(), soilProfile2D); var soilProfile1D = new SoilProfile1D(0, soilProfileName, 0, new[] { SoilLayer1DTestFactory.CreateSoilLayer1DWithValidAquifer() }); var stochasticSoilProfile1D = new StochasticSoilProfile(random.NextDouble(), soilProfile1D); var transformer = new PipingStochasticSoilModelTransformer(); StochasticSoilModel soilModel = PipingStochasticSoilModelTestFactory.CreatePipingStochasticSoilModelWithGeometry(new[] { stochasticSoilProfile2D, stochasticSoilProfile1D }); // Call PipingStochasticSoilModel transformed = transformer.Transform(soilModel); // Assert PipingStochasticSoilProfile[] transformedStochasticSoilProfiles = transformed.StochasticSoilProfiles.ToArray(); Assert.AreEqual(2, transformedStochasticSoilProfiles.Length); Assert.AreEqual(stochasticSoilProfile2D.Probability, transformedStochasticSoilProfiles[0].Probability, 1e-6); Assert.AreEqual(stochasticSoilProfile1D.Probability, transformedStochasticSoilProfiles[1].Probability, 1e-6); }
public void Transform_SoilProfile2DWithoutIntersection_ThrowsImportedDataTransformException() { // Setup const string name = "name"; var transformer = new PipingStochasticSoilModelTransformer(); StochasticSoilModel soilModel = PipingStochasticSoilModelTestFactory.CreatePipingStochasticSoilModelWithGeometry(name, new[] { StochasticSoilProfileTestFactory.CreateStochasticSoilProfileWithValidProbability(new SoilProfile2D(0, name, new[] { new SoilLayer2D(new SoilLayer2DLoop(new Segment2D[0]), Enumerable.Empty <SoilLayer2D>()) }, Enumerable.Empty <PreconsolidationStress>())) }); // Call TestDelegate test = () => transformer.Transform(soilModel); // Assert var exception = Assert.Throws <ImportedDataTransformException>(test); Assert.AreEqual($"Geen geldige X waarde gevonden om intersectie te maken uit 2D profiel '{name}'.", exception.Message); }
public void Transform_TwoStochasticSoilModelsWithSameProfile_ReturnExpectedMacroStabilityInwardsStochasticSoilModel() { // Setup SoilLayer2D layer = SoilLayer2DTestFactory.CreateSoilLayer2D(); var profile = new SoilProfile2D(2, "test", new[] { layer }, Enumerable.Empty <PreconsolidationStress>()); StochasticSoilModel soilModel1 = MacroStabilityInwardsStochasticSoilModelTestFactory.CreateMacroStabilityInwardsStochasticSoilModelWithGeometry(new[] { StochasticSoilProfileTestFactory.CreateStochasticSoilProfileWithValidProbability(profile) }); StochasticSoilModel soilModel2 = MacroStabilityInwardsStochasticSoilModelTestFactory.CreateMacroStabilityInwardsStochasticSoilModelWithGeometry(new[] { StochasticSoilProfileTestFactory.CreateStochasticSoilProfileWithValidProbability(profile) }); var transformer = new MacroStabilityInwardsStochasticSoilModelTransformer(); // Call MacroStabilityInwardsStochasticSoilModel transformedModel1 = transformer.Transform(soilModel1); MacroStabilityInwardsStochasticSoilModel transformedModel2 = transformer.Transform(soilModel2); // Assert MacroStabilityInwardsStochasticSoilProfile[] transformedStochasticSoilProfiles1 = transformedModel1.StochasticSoilProfiles.ToArray(); MacroStabilityInwardsStochasticSoilProfile[] transformedStochasticSoilProfiles2 = transformedModel2.StochasticSoilProfiles.ToArray(); Assert.AreEqual(1, transformedStochasticSoilProfiles1.Length); Assert.AreEqual(1, transformedStochasticSoilProfiles2.Length); MacroStabilityInwardsStochasticSoilProfile stochasticSoilProfile1 = transformedStochasticSoilProfiles1[0]; MacroStabilityInwardsStochasticSoilProfile stochasticSoilProfile2 = transformedStochasticSoilProfiles2[0]; Assert.AreSame(stochasticSoilProfile1.SoilProfile, stochasticSoilProfile2.SoilProfile); }
public void ReadStochasticSoilModel_ModelWithStochasticProfilesWith2DProfilesLastProfileEmpty_ReturnsModelWithStochasticProfiles() { // Setup string dbFile = Path.Combine(testDataPath, "modelWith2dProfilesLastProfileEmpty.soil"); using (var reader = new StochasticSoilModelReader(dbFile)) { reader.Validate(); // Call StochasticSoilModel model = reader.ReadStochasticSoilModel(); // Assert Assert.AreEqual("43003_Stability", model.Name); Assert.AreEqual(FailureMechanismType.Stability, model.FailureMechanismType); Assert.AreEqual(2, model.StochasticSoilProfiles.Count); var emptyProfile = (SoilProfile2D)model.StochasticSoilProfiles.First().SoilProfile; var profileWithLayers = (SoilProfile2D)model.StochasticSoilProfiles.Last().SoilProfile; CollectionAssert.IsEmpty(emptyProfile.Layers); CollectionAssert.IsNotEmpty(profileWithLayers.Layers); } Assert.IsTrue(TestHelper.CanOpenFileForWrite(dbFile)); }
public void IsValidForFailureMechanism_StochasticSoilModelOfInvalidType_ReturnsFalse(StochasticSoilModel model) { // Setup var filter = new MacroStabilityInwardsStochasticSoilModelFilter(); // Call bool isValid = filter.IsValidForFailureMechanism(model); // Assert Assert.IsFalse(isValid); }