public void Validate_SurfaceLineNotNear2DProfile_ReturnsError(MacroStabilityInwardsSoilProfile2D soilProfile) { // Setup var surfaceLine = new MacroStabilityInwardsSurfaceLine("Test"); surfaceLine.SetGeometry(new[] { new Point3D(0, 0.0, 10), new Point3D(1, 0.0, 20), new Point3D(2, 0.0, 10) }); input.StochasticSoilProfile = new MacroStabilityInwardsStochasticSoilProfile(0.0, soilProfile); input.SurfaceLine = surfaceLine; // Call IEnumerable <string> messages = MacroStabilityInwardsInputValidator.Validate(input, AssessmentSectionTestHelper.GetTestAssessmentLevel()).ToArray(); // Assert CollectionAssert.AreEqual(new[] { "De profielschematisatie moet op de ondergrondschematisatie liggen." }, messages); }
public void Validate_ValidInput_ReturnsEmpty() { // Call string[] messages = MacroStabilityInwardsInputValidator.Validate(input, AssessmentSectionTestHelper.GetTestAssessmentLevel()).ToArray(); // Assert CollectionAssert.IsEmpty(messages); }
public void Validate_InputNull_ThrowArgumentNullException() { // Call TestDelegate test = () => MacroStabilityInwardsInputValidator.Validate(null, RoundedDouble.NaN); // Assert var exception = Assert.Throws <ArgumentNullException>(test); Assert.AreEqual("inputParameters", exception.ParamName); }
public void Validate_SingleTangentLineWithTangentLineTopAndBottomSame_ReturnsEmpty() { // Setup input.TangentLineNumber = 1; input.TangentLineZTop = (RoundedDouble)1.59; input.TangentLineZBottom = (RoundedDouble)1.59; // Call IEnumerable <string> messages = MacroStabilityInwardsInputValidator.Validate(input, AssessmentSectionTestHelper.GetTestAssessmentLevel()).ToArray(); // Assert CollectionAssert.IsEmpty(messages); }
public void Validate_NormativeAssessmentLevelNotCalculated_LogsErrorAndReturnsFalse() { // Setup input.UseAssessmentLevelManualInput = false; // Call IEnumerable <string> messages = MacroStabilityInwardsInputValidator.Validate(input, RoundedDouble.NaN).ToArray(); // Assert CollectionAssert.AreEqual(new[] { "Kan de waterstand niet afleiden op basis van de invoer." }, messages); }
public void Validate_WithoutStochasticSoilProfile_ReturnsError() { // Setup input.StochasticSoilProfile = null; // Call IEnumerable <string> messages = MacroStabilityInwardsInputValidator.Validate(input, AssessmentSectionTestHelper.GetTestAssessmentLevel()).ToArray(); // Assert CollectionAssert.AreEqual(new[] { "Er is geen ondergrondschematisatie geselecteerd." }, messages); }
public void Validate_InvalidManualAssessmentLevel_ReturnsError(double assessmentLevel) { // Setup input.UseAssessmentLevelManualInput = true; input.AssessmentLevel = (RoundedDouble)assessmentLevel; // Call IEnumerable <string> messages = MacroStabilityInwardsInputValidator.Validate(input, AssessmentSectionTestHelper.GetTestAssessmentLevel()).ToArray(); // Assert CollectionAssert.AreEqual(new[] { "De waarde voor 'Waterstand' moet een concreet getal zijn." }, messages); }
public void Validate_MultipleTangentLinesWithTangentLineTopAndBottomNotSame_ReturnsEmpty() { // Setup var random = new Random(21); input.TangentLineNumber = random.Next(2, 50); input.TangentLineZTop = (RoundedDouble)1.5; input.TangentLineZBottom = (RoundedDouble)0.2; // Call IEnumerable <string> messages = MacroStabilityInwardsInputValidator.Validate(input, AssessmentSectionTestHelper.GetTestAssessmentLevel()).ToArray(); // Assert CollectionAssert.IsEmpty(messages); }
public void Validate_ZoneBoundariesOutsideSurfaceLine_ReturnsError(double zoneBoundaryLeft, double zoneBoundaryRight) { // Setup input.ZoneBoundaryLeft = (RoundedDouble)zoneBoundaryLeft; input.ZoneBoundaryRight = (RoundedDouble)zoneBoundaryRight; // Call IEnumerable <string> messages = MacroStabilityInwardsInputValidator.Validate(input, AssessmentSectionTestHelper.GetTestAssessmentLevel()).ToArray(); // Assert CollectionAssert.AreEqual(new[] { "Zoneringsgrenzen moeten op het profiel liggen (bereik [0,0, 0,5])." }, messages); }
public void Validate_ZoneBoundaryRightSmallerThanZoneBoundaryLeft_ReturnsError() { // Setup input.ZoneBoundaryLeft = (RoundedDouble)0.5; input.ZoneBoundaryRight = (RoundedDouble)0.2; // Call IEnumerable <string> messages = MacroStabilityInwardsInputValidator.Validate(input, AssessmentSectionTestHelper.GetTestAssessmentLevel()).ToArray(); // Assert CollectionAssert.AreEqual(new[] { "Zoneringsgrens links moet kleiner zijn dan of gelijk zijn aan zoneringsgrens rechts." }, messages); }
public void Validate_SoilProfile1DTopDoesNotExceedSurfaceLineTop_ReturnsError(double differenceFromTop) { // Setup const double surfaceLineTop = 5.0; var stochasticSoilProfile = new MacroStabilityInwardsStochasticSoilProfile(1, new MacroStabilityInwardsSoilProfile1D("profile", 0.0, new[] { new MacroStabilityInwardsSoilLayer1D(surfaceLineTop - differenceFromTop) })); var surfaceLine = new MacroStabilityInwardsSurfaceLine("Test"); var firstCharacteristicPointLocation = new Point3D(0.1, 0.0, 0.0); var secondCharacteristicPointLocation = new Point3D(0.2, 0.0, 1.0); var thirdCharacteristicPointLocation = new Point3D(0.3, 0.0, 2.0); var fourthCharacteristicPointLocation = new Point3D(0.4, 0.0, 3.0); var fifthCharacteristicPointLocation = new Point3D(0.5, 0.0, 4.0); var sixthCharacteristicPointLocation = new Point3D(0.6, 0.0, surfaceLineTop); surfaceLine.SetGeometry(new[] { firstCharacteristicPointLocation, secondCharacteristicPointLocation, thirdCharacteristicPointLocation, fourthCharacteristicPointLocation, fifthCharacteristicPointLocation, sixthCharacteristicPointLocation }); surfaceLine.SetSurfaceLevelOutsideAt(firstCharacteristicPointLocation); surfaceLine.SetDikeToeAtRiverAt(secondCharacteristicPointLocation); surfaceLine.SetDikeTopAtRiverAt(thirdCharacteristicPointLocation); surfaceLine.SetDikeTopAtPolderAt(fourthCharacteristicPointLocation); surfaceLine.SetDikeToeAtPolderAt(fifthCharacteristicPointLocation); surfaceLine.SetSurfaceLevelInsideAt(sixthCharacteristicPointLocation); input.StochasticSoilProfile = stochasticSoilProfile; input.SurfaceLine = surfaceLine; // Call IEnumerable <string> messages = MacroStabilityInwardsInputValidator.Validate(input, AssessmentSectionTestHelper.GetTestAssessmentLevel()).ToArray(); // Assert CollectionAssert.AreEqual(new[] { "De ondergrondschematisatie moet boven de profielschematisatie liggen." }, messages); }
public void Validate_SurfaceLineNear2DProfileWithFloatingLayerDefinitions_ReturnsError() { // Setup var surfaceLine = new MacroStabilityInwardsSurfaceLine("Test"); surfaceLine.SetGeometry(new[] { new Point3D(0, 0.0, 20), new Point3D(20, 0.0, 20) }); var soilProfile = new MacroStabilityInwardsSoilProfile2D( "profile", new[] { new MacroStabilityInwardsSoilLayer2D(new Ring(new[] { new Point2D(0, 20), new Point2D(5, 20), new Point2D(5, 15), new Point2D(20, 15), new Point2D(20, 10), new Point2D(0, 10) })), new MacroStabilityInwardsSoilLayer2D(new Ring(new[] { new Point2D(10, 17), new Point2D(10, 20), new Point2D(20, 20), new Point2D(20, 17) })) }, new MacroStabilityInwardsPreconsolidationStress[0]); input.StochasticSoilProfile = new MacroStabilityInwardsStochasticSoilProfile(0.0, soilProfile); input.SurfaceLine = surfaceLine; // Call IEnumerable <string> messages = MacroStabilityInwardsInputValidator.Validate(input, AssessmentSectionTestHelper.GetTestAssessmentLevel()).ToArray(); // Assert CollectionAssert.AreEqual(new[] { "De profielschematisatie moet op de ondergrondschematisatie liggen." }, messages); }
public void Validate_ZoningBoundariesDeterminationTypeManualOrCreateZonesFalse_ReturnsEmpty( MacroStabilityInwardsZoningBoundariesDeterminationType determinationType, bool createZones) { // Setup input.ZoneBoundaryLeft = (RoundedDouble)1; input.ZoneBoundaryRight = (RoundedDouble)0.6; input.ZoningBoundariesDeterminationType = determinationType; input.CreateZones = createZones; // Call IEnumerable <string> messages = MacroStabilityInwardsInputValidator.Validate(input, AssessmentSectionTestHelper.GetTestAssessmentLevel()).ToArray(); // Assert CollectionAssert.IsEmpty(messages); }
public void Validate_InvalidCalculationInput_ReturnsErrors() { // Setup input = new MacroStabilityInwardsInput(new MacroStabilityInwardsInput.ConstructionProperties()); // Call IEnumerable <string> messages = MacroStabilityInwardsInputValidator.Validate(input, AssessmentSectionTestHelper.GetTestAssessmentLevel()).ToArray(); // Assert CollectionAssert.AreEqual(new[] { "Er is geen hydraulische belastingenlocatie geselecteerd.", "Er is geen profielschematisatie geselecteerd.", "Er is geen ondergrondschematisatie geselecteerd." }, messages); }
public void Validate_SurfaceLineNear2DProfileWithLayersWithTriangularXCoordinateDefinitions_ReturnsEmpty() { // Setup var surfaceLine = new MacroStabilityInwardsSurfaceLine("Test"); surfaceLine.SetGeometry(new[] { new Point3D(0, 0.0, 10), new Point3D(10, 0.0, 20), new Point3D(20, 0.0, 10) }); var soilProfile = new MacroStabilityInwardsSoilProfile2D( "profile", new[] { new MacroStabilityInwardsSoilLayer2D(new Ring(new[] { new Point2D(0, 10), new Point2D(10, 20), new Point2D(20, 10) })), new MacroStabilityInwardsSoilLayer2D(new Ring(new[] { new Point2D(0, 10), new Point2D(5, 15), new Point2D(7.5, 10), new Point2D(12.5, 10), new Point2D(15, 15), new Point2D(20, 10) })) }, new MacroStabilityInwardsPreconsolidationStress[0]); input.StochasticSoilProfile = new MacroStabilityInwardsStochasticSoilProfile(0.0, soilProfile); input.SurfaceLine = surfaceLine; // Call IEnumerable <string> messages = MacroStabilityInwardsInputValidator.Validate(input, AssessmentSectionTestHelper.GetTestAssessmentLevel()).ToArray(); // Assert CollectionAssert.IsEmpty(messages); }
public void Validate_MultipleTangentLinesWithTangentLineTopAndBottomSame_ReturnsError() { // Setup var random = new Random(21); input.TangentLineNumber = random.Next(2, 50); input.TangentLineZTop = (RoundedDouble)1.5; input.TangentLineZBottom = (RoundedDouble)1.5; // Call IEnumerable <string> messages = MacroStabilityInwardsInputValidator.Validate(input, AssessmentSectionTestHelper.GetTestAssessmentLevel()).ToArray(); // Assert CollectionAssert.AreEqual(new[] { "Het aantal tangentlijnen moet 1 zijn wanneer tangentlijn Z-boven gelijk is aan tangentlijn Z-onder." }, messages); }
public void Validate_SurfaceLineNear2DProfile_ReturnsEmpty(MacroStabilityInwardsSoilProfile2D soilProfile) { // Setup var surfaceLine = new MacroStabilityInwardsSurfaceLine("Test"); surfaceLine.SetGeometry(new[] { new Point3D(0.0, 0.0, 10), new Point3D(0.1, 0.0, 20), new Point3D(0.2, 0.0, 10) }); input.StochasticSoilProfile = new MacroStabilityInwardsStochasticSoilProfile(0.0, soilProfile); input.SurfaceLine = surfaceLine; // Call IEnumerable <string> messages = MacroStabilityInwardsInputValidator.Validate(input, AssessmentSectionTestHelper.GetTestAssessmentLevel()).ToArray(); // Assert CollectionAssert.IsEmpty(messages); }