public void Constructor_ExpectedValues() { // Call var properties = new GrassCoverErosionInwardsInputContextDikeGeometryProperties(); // Assert Assert.IsInstanceOf <ObjectProperties <GrassCoverErosionInwardsInputContext> >(properties); Assert.IsNull(properties.Data); Assert.IsEmpty(properties.ToString()); }
public void Data_SetInputContextInstanceWithData_ReturnCorrectPropertyValues() { // Setup var assessmentSection = mockRepository.Stub <IAssessmentSection>(); mockRepository.ReplayAll(); var failureMechanism = new GrassCoverErosionInwardsFailureMechanism(); DikeProfile dikeProfile = DikeProfileTestFactory.CreateDikeProfile(new[] { new RoughnessPoint(new Point2D(1.1, 2.2), 0.6), new RoughnessPoint(new Point2D(3.3, 4.4), 0.7) }); var calculation = new GrassCoverErosionInwardsCalculation { InputParameters = { DikeProfile = dikeProfile } }; var properties = new GrassCoverErosionInwardsInputContextDikeGeometryProperties(); // Call properties.Data = new GrassCoverErosionInwardsInputContext(calculation.InputParameters, calculation, failureMechanism, assessmentSection); // Assert var expectedCoordinates = new[] { new Point2D(1.1, 2.2), new Point2D(3.3, 4.4) }; CollectionAssert.AreEqual(expectedCoordinates, properties.Coordinates); var expectedRoughness = new[] { new RoundedDouble(2, 0.6) }; CollectionAssert.AreEqual(expectedRoughness, properties.Roughnesses); mockRepository.VerifyAll(); }
public void Data_SetNewInputContextInstance_ReturnCorrectPropertyValues() { // Setup var assessmentSection = mockRepository.Stub <IAssessmentSection>(); mockRepository.ReplayAll(); var failureMechanism = new GrassCoverErosionInwardsFailureMechanism(); var calculation = new GrassCoverErosionInwardsCalculation(); var input = new GrassCoverErosionInwardsInput(); var properties = new GrassCoverErosionInwardsInputContextDikeGeometryProperties(); // Call properties.Data = new GrassCoverErosionInwardsInputContext(input, calculation, failureMechanism, assessmentSection); // Assert CollectionAssert.IsEmpty(properties.Coordinates); CollectionAssert.IsEmpty(properties.Roughnesses); mockRepository.VerifyAll(); }
public void Constructor_Always_PropertiesHaveExpectedAttributesValues() { // Setup var assessmentSection = mockRepository.Stub <IAssessmentSection>(); mockRepository.ReplayAll(); var failureMechanism = new GrassCoverErosionInwardsFailureMechanism(); var calculation = new GrassCoverErosionInwardsCalculation(); var input = new GrassCoverErosionInwardsInput(); // Call var properties = new GrassCoverErosionInwardsInputContextDikeGeometryProperties { Data = new GrassCoverErosionInwardsInputContext(input, calculation, failureMechanism, assessmentSection) }; // Assert PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); Assert.AreEqual(2, dynamicProperties.Count); PropertyDescriptor coordinatesProperty = dynamicProperties[coordinatesPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(coordinatesProperty, "Misc", "Coördinaten [m]", "Lijst met punten in lokale coördinaten.", true); PropertyDescriptor roughnessesProperty = dynamicProperties[roughnessesPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(roughnessesProperty, "Misc", "Ruwheid invloedsfactoren [-]", "Lijst met invloedsfactoren voor ruwheid op het talud van elk onderdeel.", true); mockRepository.VerifyAll(); }