public void Transform_SoilProfileNull_ThrowsArgumentNullException() { // Setup var mocks = new MockRepository(); var soilProfile = mocks.Stub <ISoilProfile>(); mocks.ReplayAll(); StochasticSoilProfile stochasticSoilProfile = StochasticSoilProfileTestFactory.CreateStochasticSoilProfileWithValidProbability(soilProfile); // Call TestDelegate call = () => MacroStabilityInwardsStochasticSoilProfileTransformer.Transform(stochasticSoilProfile, null); // Assert var exception = Assert.Throws <ArgumentNullException>(call); Assert.AreEqual("soilProfile", exception.ParamName); mocks.VerifyAll(); }
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_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_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); }