public void DikeProfile_OnChangeToNull_CorrectColumnStates() { // Setup var calculationScenario = new GrassCoverErosionInwardsCalculationScenario { InputParameters = { DikeProfile = DikeProfileTestFactory.CreateDikeProfile() } }; // Call var row = new GrassCoverErosionInwardsCalculationRow(calculationScenario, new ObservablePropertyChangeHandler( calculationScenario, new GrassCoverErosionInwardsInput())) { DikeProfile = new DataGridViewComboBoxItemWrapper <DikeProfile>(null) }; // Assert IDictionary <int, DataGridViewColumnStateDefinition> columnStateDefinitions = row.ColumnStateDefinitions; DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnState(columnStateDefinitions[useBreakWaterColumnIndex], false); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnState(columnStateDefinitions[breakWaterTypeColumnIndex], false); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnState(columnStateDefinitions[breakWaterHeightColumnIndex], false); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnState(columnStateDefinitions[useForeshoreColumnIndex], false); }
public void Constructor_DikeProfileWithForeshoreGeometry_CorrectColumnStates(bool useBreakWater) { // Setup var calculationScenario = new GrassCoverErosionInwardsCalculationScenario { InputParameters = { DikeProfile = DikeProfileTestFactory.CreateDikeProfile(new[] { new Point2D(0.0, 0.0) }), UseBreakWater = useBreakWater } }; // Call var row = new GrassCoverErosionInwardsCalculationRow(calculationScenario, new ObservablePropertyChangeHandler( calculationScenario, new GrassCoverErosionInwardsInput())); // Assert IDictionary <int, DataGridViewColumnStateDefinition> columnStateDefinitions = row.ColumnStateDefinitions; DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnState(columnStateDefinitions[useBreakWaterColumnIndex], true); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnState(columnStateDefinitions[breakWaterTypeColumnIndex], useBreakWater); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnState(columnStateDefinitions[breakWaterHeightColumnIndex], useBreakWater); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnState(columnStateDefinitions[useForeshoreColumnIndex], true); }
public void Import_ValidConfigurationInvalidOrientation_LogMessageAndContinueImport() { // Setup string filePath = Path.Combine(importerPath, "validConfigurationOrientationOutOfRange.xml"); var calculationGroup = new CalculationGroup(); var importer = new GrassCoverErosionInwardsCalculationConfigurationImporter( filePath, calculationGroup, new FailureMechanismContribution(0.01, 0.001), Enumerable.Empty <HydraulicBoundaryLocation>(), new[] { DikeProfileTestFactory.CreateDikeProfile("Dijkprofiel", "Dijkprofiel ID") }); // Call var successful = false; void Call() => successful = importer.Import(); // Assert const string expectedMessage = "Een waarde van '380' als oriƫntatie is ongeldig. De waarde voor de oriƫntatie moet in het bereik [0,00, 360,00] liggen. " + "Berekening 'Berekening 1' is overgeslagen."; TestHelper.AssertLogMessageIsGenerated(Call, expectedMessage, 2); Assert.IsTrue(successful); CollectionAssert.IsEmpty(calculationGroup.Children); }
/// <summary> /// This method sets random data values to all properties of <paramref name="input"/>. /// </summary> /// <param name="input">The input to set the random data values to.</param> public static void SetRandomDataToGrassCoverErosionInwardsInput(GrassCoverErosionInwardsInput input) { var random = new Random(21); input.Orientation = random.NextRoundedDouble(); input.DikeHeight = random.NextRoundedDouble(); input.CriticalFlowRate = new LogNormalDistribution { Mean = random.NextRoundedDouble(), StandardDeviation = random.NextRoundedDouble() }; input.HydraulicBoundaryLocation = new TestHydraulicBoundaryLocation(); input.ShouldDikeHeightBeCalculated = random.NextBoolean(); input.DikeHeightTargetProbability = random.NextDouble(1e-15, 0.1); input.ShouldDikeHeightIllustrationPointsBeCalculated = random.NextBoolean(); input.ShouldOvertoppingRateBeCalculated = random.NextBoolean(); input.OvertoppingRateTargetProbability = random.NextDouble(1e-15, 0.1); input.ShouldOvertoppingRateIllustrationPointsBeCalculated = random.NextBoolean(); input.ShouldOvertoppingOutputIllustrationPointsBeCalculated = random.NextBoolean(); input.DikeProfile = DikeProfileTestFactory.CreateDikeProfile(); input.UseBreakWater = random.NextBoolean(); input.BreakWater.Type = random.NextEnumValue <BreakWaterType>(); input.BreakWater.Height = random.NextRoundedDouble(); input.UseForeshore = random.NextBoolean(); }
public void IsDikeProfileIntersectionWithReferenceLineInSection_EmptySegmentCollection_ThrowsInvalidOperationException() { // Setup DikeProfile dikeProfile = DikeProfileTestFactory.CreateDikeProfile(new Point2D(0.0, 0.0)); var referenceLine = new ReferenceLine(); referenceLine.SetGeometry(new[] { new Point2D(0.0, 0.0), new Point2D(10.0, 0.0) }); var calculation = new GrassCoverErosionInwardsCalculationScenario { InputParameters = { DikeProfile = dikeProfile } }; // Call void Call() => calculation.IsDikeProfileIntersectionWithReferenceLineInSection(Enumerable.Empty <Segment2D>()); // Assert Assert.Throws <InvalidOperationException>(Call); }
public void IsDikeProfileIntersectionWithReferenceLineInSection_DikeProfileDoesNotIntersectReferenceLine_ReturnsFalse() { // Setup DikeProfile dikeProfile = DikeProfileTestFactory.CreateDikeProfile(new Point2D(0.0, 0.0)); var referenceLine = new ReferenceLine(); referenceLine.SetGeometry(new[] { new Point2D(10.0, 0.0), new Point2D(20.0, 0.0) }); var calculation = new GrassCoverErosionInwardsCalculationScenario { InputParameters = { DikeProfile = dikeProfile } }; IEnumerable <Segment2D> lineSegments = Math2D.ConvertPointsToLineSegments(referenceLine.Points); // Call bool intersects = calculation.IsDikeProfileIntersectionWithReferenceLineInSection(lineSegments); // Assert Assert.IsFalse(intersects); }
public void CurrentPath_DikeProfileCollectionHasPathSet_ReturnsExpectedPath() { // Setup var mocks = new MockRepository(); var assessmentSection = mocks.Stub <IAssessmentSection>(); mocks.ReplayAll(); const string expectedFilePath = "some/path"; var surfaceLines = new DikeProfileCollection(); surfaceLines.AddRange(new[] { DikeProfileTestFactory.CreateDikeProfile() }, expectedFilePath); var failureMechanism = new GrassCoverErosionInwardsFailureMechanism(); var context = new DikeProfilesContext(surfaceLines, failureMechanism, assessmentSection); using (var plugin = new GrassCoverErosionInwardsPlugin()) { UpdateInfo updateInfo = GetUpdateInfo(plugin); // Call string currentFilePath = updateInfo.CurrentPath(context); // Assert Assert.AreEqual(expectedFilePath, currentFilePath); mocks.VerifyAll(); } }
public void CreateCalculationFeatures_GivenCalculations_ReturnsCalculationFeaturesCollection() { // Setup var calculationA = new GrassCoverErosionInwardsCalculation(); var calculationB = new GrassCoverErosionInwardsCalculation(); calculationA.InputParameters.DikeProfile = DikeProfileTestFactory.CreateDikeProfile(new Point2D(1.0, 3.0)); calculationB.InputParameters.DikeProfile = DikeProfileTestFactory.CreateDikeProfile(new Point2D(1.0, 4.0)); calculationA.InputParameters.HydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, string.Empty, 5.0, 4.0); calculationB.InputParameters.HydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, string.Empty, 2.2, 3.8); // Call IEnumerable <MapFeature> features = GrassCoverErosionInwardsMapDataFeaturesFactory.CreateCalculationFeatures(new[] { calculationA, calculationB }); // Assert Assert.AreEqual(2, features.Count()); Assert.AreEqual(1, features.ElementAt(0).MapGeometries.Count()); Assert.AreEqual(1, features.ElementAt(1).MapGeometries.Count()); AssertEqualPointCollections(new[] { new Point2D(1.0, 3.0), new Point2D(5.0, 4.0) }, features.ElementAt(0).MapGeometries.ElementAt(0)); AssertEqualPointCollections(new[] { new Point2D(1.0, 4.0), new Point2D(2.2, 3.8) }, features.ElementAt(1).MapGeometries.ElementAt(0)); }
public void UpdateDikeProfilesWithImportedData_WithCurrentDikeProfileAndImportedMultipleDikeProfilesWithSameId_ThrowsUpdateException() { // Setup const string duplicateId = "A duplicated ID"; DikeProfile expectedDikeProfile = DikeProfileTestFactory.CreateDikeProfile("expectedName", duplicateId); var targetCollection = new DikeProfileCollection(); DikeProfile[] expectedTargetCollection = { expectedDikeProfile }; targetCollection.AddRange(expectedTargetCollection, sourceFilePath); DikeProfile[] importedTargetCollection = { DeepCloneAndModify(expectedDikeProfile), DeepCloneAndModify(expectedDikeProfile) }; var strategy = new GrassCoverErosionInwardsDikeProfileUpdateDataStrategy(new GrassCoverErosionInwardsFailureMechanism()); // Call void Call() => strategy.UpdateDikeProfilesWithImportedData(importedTargetCollection, sourceFilePath); // Assert var exception = Assert.Throws <UpdateDataException>(Call); const string expectedMessage = "GeĆÆmporteerde data moet unieke elementen bevatten."; Assert.AreEqual(expectedMessage, exception.Message); CollectionAssert.AreEqual(expectedTargetCollection, targetCollection); AssertDikeProfile(expectedDikeProfile, targetCollection[0]); }
public void Constructor_Always_PropertiesHaveExpectedAttributesValues() { // Setup DikeProfile dikeProfile = DikeProfileTestFactory.CreateDikeProfile(); // Call var properties = new DikeProfileDikeGeometryProperties { Data = dikeProfile }; // 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); }
public void UpdateDikeProfilesWithImportedData_CurrentCollectionEmptyAndReadProfilesHaveDuplicateIds_ThrowsUpdateException() { // Setup const string duplicateId = "A duplicated ID"; DikeProfile dikeProfileOne = DikeProfileTestFactory.CreateDikeProfile("name one", duplicateId); DikeProfile dikeProfileTwo = DikeProfileTestFactory.CreateDikeProfile("Another dike profile", duplicateId); var targetCollection = new DikeProfileCollection(); var strategy = new GrassCoverErosionInwardsDikeProfileUpdateDataStrategy(new GrassCoverErosionInwardsFailureMechanism()); // Call void Call() => strategy.UpdateDikeProfilesWithImportedData(new[] { dikeProfileOne, dikeProfileTwo }, sourceFilePath); // Assert var exception = Assert.Throws <UpdateDataException>(Call); const string expectedMessage = "GeĆÆmporteerde data moet unieke elementen bevatten."; Assert.AreEqual(expectedMessage, exception.Message); CollectionAssert.IsEmpty(targetCollection); }
private static GrassCoverErosionInwardsFailureMechanism ConfigureFailureMechanism() { var failureMechanism = new GrassCoverErosionInwardsFailureMechanism(); FailureMechanismTestHelper.SetSections(failureMechanism, new[] { new FailureMechanismSection("Section 1", new[] { new Point2D(0.0, 0.0), new Point2D(5.0, 0.0) }), new FailureMechanismSection("Section 2", new[] { new Point2D(5.0, 0.0), new Point2D(10.0, 0.0) }) }); failureMechanism.DikeProfiles.AddRange(new List <DikeProfile> { DikeProfileTestFactory.CreateDikeProfile("1", "Profiel 1", new Point2D(0.0, 0.0)), DikeProfileTestFactory.CreateDikeProfile("2", "Profiel 2", new Point2D(5.0, 0.0)) }, string.Empty); return(failureMechanism); }
public void Data_SetDikeProfileInstanceWithData_ReturnCorrectPropertyValues() { // Setup DikeProfile dikeProfile = DikeProfileTestFactory.CreateDikeProfile(new[] { new RoughnessPoint(new Point2D(0, 0), 0.6), new RoughnessPoint(new Point2D(1, 1), 0.7) }); var properties = new DikeProfileDikeGeometryProperties(); // Call properties.Data = dikeProfile; // Assert var expectedCoordinates = new[] { new Point2D(0, 0), new Point2D(1, 1) }; CollectionAssert.AreEqual(expectedCoordinates, properties.Coordinates); var expectedRoughness = new[] { new RoundedDouble(2, 0.6) }; CollectionAssert.AreEqual(expectedRoughness, properties.Roughnesses); }
public void GivenFailureMechanismWithDikeProfiles_WhenAddingAndRemovingElements_ThenCollectionIsUpdated() { // Scenario var failureMechanism = new GrassCoverErosionInwardsFailureMechanism(); const string filePath = "path"; DikeProfile dikeProfile1 = DikeProfileTestFactory.CreateDikeProfile(new Point2D(0, 0), "id1"); DikeProfile dikeProfile2 = DikeProfileTestFactory.CreateDikeProfile(new Point2D(1, 1), "id2"); DikeProfile dikeProfile3 = DikeProfileTestFactory.CreateDikeProfile(new Point2D(2, 2), "id3"); failureMechanism.DikeProfiles.AddRange(new[] { dikeProfile1 }, filePath); // Event failureMechanism.DikeProfiles.AddRange(new[] { dikeProfile3, dikeProfile2 }, filePath); failureMechanism.DikeProfiles.Remove(dikeProfile1); // Result DikeProfile[] expectedDikeProfiles = { dikeProfile3, dikeProfile2 }; CollectionAssert.AreEqual(expectedDikeProfiles, failureMechanism.DikeProfiles); }
public void ForeColor_CollectionHasElementsEmpty_ReturnControlText() { // Setup var mocks = new MockRepository(); var assessmentSection = mocks.Stub <IAssessmentSection>(); mocks.ReplayAll(); var failureMechanism = new GrassCoverErosionInwardsFailureMechanism(); failureMechanism.DikeProfiles.AddRange(new[] { DikeProfileTestFactory.CreateDikeProfile() }, "path"); // Precondition CollectionAssert.IsNotEmpty(failureMechanism.DikeProfiles); var context = new DikeProfilesContext(failureMechanism.DikeProfiles, failureMechanism, assessmentSection); // Call Color color = info.ForeColor(context); // Assert Assert.AreEqual(Color.FromKnownColor(KnownColor.ControlText), color); mocks.VerifyAll(); }
public void UpdateDikeProfilesWithImportedData_DikeProfilePropertiesChanged_UpdateRelevantProperties() { // Setup DikeProfile dikeProfileToUpdate = DikeProfileTestFactory.CreateDikeProfile("name", "ID A"); DikeProfile dikeProfileToUpdateFrom = DeepCloneAndModify(dikeProfileToUpdate); var failureMechanism = new GrassCoverErosionInwardsFailureMechanism(); DikeProfileCollection targetCollection = failureMechanism.DikeProfiles; targetCollection.AddRange(new[] { dikeProfileToUpdate }, sourceFilePath); var strategy = new GrassCoverErosionInwardsDikeProfileUpdateDataStrategy(failureMechanism); // Call strategy.UpdateDikeProfilesWithImportedData(new[] { dikeProfileToUpdateFrom }, sourceFilePath); // Assert Assert.AreSame(dikeProfileToUpdate, targetCollection[0]); AssertDikeProfile(dikeProfileToUpdateFrom, dikeProfileToUpdate); }
public void GenerateCalculations_Always_SetsCorrectCalculations() { // Setup var calculationGroup = new CalculationGroup(); DikeProfile dikeProfile1 = DikeProfileTestFactory.CreateDikeProfile(new Point2D(0.0, 0.0), "profiel 1"); DikeProfile dikeProfile2 = DikeProfileTestFactory.CreateDikeProfile(new Point2D(0.0, 0.0), "profiel 2"); var failureMechanismContribution = new FailureMechanismContribution(0.01, 0.001); // Call GrassCoverErosionInwardsCalculationConfigurationHelper.GenerateCalculations( calculationGroup, new[] { dikeProfile1, dikeProfile2 }, failureMechanismContribution); // Assert Assert.AreEqual(2, calculationGroup.Children.Count); var calculation1 = (GrassCoverErosionInwardsCalculationScenario)calculationGroup.Children.First(); Assert.AreEqual("name", calculation1.Name); Assert.AreEqual(dikeProfile1, calculation1.InputParameters.DikeProfile); Assert.AreEqual(failureMechanismContribution.NormativeProbability, calculation1.InputParameters.DikeHeightTargetProbability); Assert.AreEqual(failureMechanismContribution.NormativeProbability, calculation1.InputParameters.OvertoppingRateTargetProbability); var calculation2 = (GrassCoverErosionInwardsCalculationScenario)calculationGroup.Children.Last(); Assert.AreEqual("name (1)", calculation2.Name); Assert.AreEqual(dikeProfile2, calculation2.InputParameters.DikeProfile); Assert.AreEqual(failureMechanismContribution.NormativeProbability, calculation2.InputParameters.DikeHeightTargetProbability); Assert.AreEqual(failureMechanismContribution.NormativeProbability, calculation2.InputParameters.OvertoppingRateTargetProbability); }
public void Create_WithDikeProfiles_AddDikeProfileEntities() { // Setup const string filePath = "some/path/to/my/dikeprofiles"; var failureMechanism = new GrassCoverErosionInwardsFailureMechanism(); failureMechanism.DikeProfiles.AddRange(new[] { DikeProfileTestFactory.CreateDikeProfile(string.Empty, "id1"), DikeProfileTestFactory.CreateDikeProfile(string.Empty, "id2") }, filePath); var registry = new PersistenceRegistry(); // Call FailureMechanismEntity entity = failureMechanism.Create(registry); // Assert Assert.AreEqual(2, entity.DikeProfileEntities.Count); GrassCoverErosionInwardsFailureMechanismMetaEntity generalInputEntity = entity.GrassCoverErosionInwardsFailureMechanismMetaEntities.Single(); TestHelper.AssertAreEqualButNotSame(filePath, generalInputEntity.DikeProfileCollectionSourcePath); }
public void UpdateDikeProfilesWithImportedData_CollectionAndImportedDataCollectionNotEmpty_ReplacesCurrentWithImportedData() { // Setup DikeProfile targetDikeProfile = DikeProfileTestFactory.CreateDikeProfile("Name A", "Name A ID"); var failureMechanism = new GrassCoverErosionInwardsFailureMechanism(); failureMechanism.DikeProfiles.AddRange(new[] { targetDikeProfile }, sourceFilePath); DikeProfile readDikeProfile = DikeProfileTestFactory.CreateDikeProfile("Name B", "Name B ID"); var strategy = new GrassCoverErosionInwardsDikeProfileReplaceDataStrategy(failureMechanism); // Call IEnumerable <IObservable> affectedObjects = strategy.UpdateDikeProfilesWithImportedData(new[] { readDikeProfile }, sourceFilePath); // Assert CollectionAssert.AreEqual(new[] { failureMechanism.DikeProfiles }, affectedObjects); DikeProfile[] expectedDikeProfiles = { readDikeProfile }; CollectionAssert.AreEqual(expectedDikeProfiles, failureMechanism.DikeProfiles); }
public void ChildNodeObjects_Always_ReturnDikeProfiles() { // Setup var mocks = new MockRepository(); var assessmentSection = mocks.Stub <IAssessmentSection>(); mocks.ReplayAll(); DikeProfile dikeProfile1 = DikeProfileTestFactory.CreateDikeProfile(string.Empty, "id1"); DikeProfile dikeProfile2 = DikeProfileTestFactory.CreateDikeProfile(string.Empty, "id2"); var failureMechanism = new GrassCoverErosionInwardsFailureMechanism(); failureMechanism.DikeProfiles.AddRange(new[] { dikeProfile1, dikeProfile2 }, "path"); var dikeProfilesContext = new DikeProfilesContext(failureMechanism.DikeProfiles, failureMechanism, assessmentSection); // Call object[] children = info.ChildNodeObjects(dikeProfilesContext); // Assert Assert.AreEqual(2, children.Length); Assert.AreSame(dikeProfile1, children.ElementAt(0)); Assert.AreSame(dikeProfile2, children.ElementAt(1)); mocks.VerifyAll(); }
public void UpdateDikeProfilesWithImportedData_WithCurrentDikeProfilesAndImportedDataHasPartialOverlap_UpdatesTargetCollection() { // Setup const string addedDikeProfileId = "ID A"; const string removedDikeProfileId = "ID B"; const string updatedDikeProfileId = "ID C"; const string commonName = "Just a name for dike profile"; DikeProfile dikeProfileToBeRemoved = DikeProfileTestFactory.CreateDikeProfile(commonName, removedDikeProfileId); DikeProfile dikeProfileToBeUpdated = DikeProfileTestFactory.CreateDikeProfile(commonName, updatedDikeProfileId); var failureMechanism = new GrassCoverErosionInwardsFailureMechanism(); DikeProfileCollection dikeProfiles = failureMechanism.DikeProfiles; dikeProfiles.AddRange(new[] { dikeProfileToBeRemoved, dikeProfileToBeUpdated }, sourceFilePath); DikeProfile dikeProfileToUpdateFrom = DeepCloneAndModify(dikeProfileToBeUpdated); DikeProfile dikeProfileToBeAdded = DikeProfileTestFactory.CreateDikeProfile(commonName, addedDikeProfileId); DikeProfile[] readDikeProfiles = { dikeProfileToBeAdded, dikeProfileToUpdateFrom }; var strategy = new GrassCoverErosionInwardsDikeProfileUpdateDataStrategy(failureMechanism); // Call IEnumerable <IObservable> affectedObjects = strategy.UpdateDikeProfilesWithImportedData(readDikeProfiles, sourceFilePath); // Assert Assert.AreEqual(2, dikeProfiles.Count); DikeProfile[] expectedDikeProfiles = { dikeProfileToBeAdded, dikeProfileToBeUpdated }; CollectionAssert.AreEqual(expectedDikeProfiles, dikeProfiles); DikeProfile addedDikeProfile = dikeProfiles[0]; Assert.AreSame(dikeProfileToBeAdded, addedDikeProfile); AssertDikeProfile(dikeProfileToBeAdded, addedDikeProfile); DikeProfile updatedDikeProfile = dikeProfiles[1]; Assert.AreSame(dikeProfileToBeUpdated, updatedDikeProfile); AssertDikeProfile(dikeProfileToUpdateFrom, updatedDikeProfile); CollectionAssert.AreEquivalent(new IObservable[] { dikeProfileToBeUpdated, dikeProfiles }, affectedObjects); }
public void Import_UseForeshoreButProfileWithoutGeometry_LogMessageAndContinueImport() { // Setup string filePath = Path.Combine(importerPath, "validConfigurationCalculationUseForeshoreWithoutGeometry.xml"); var calculationGroup = new CalculationGroup(); DikeProfile dikeProfile = DikeProfileTestFactory.CreateDikeProfile("Dijkprofiel", "Dijkprofiel ID"); var importer = new GrassCoverErosionInwardsCalculationConfigurationImporter( filePath, calculationGroup, new FailureMechanismContribution(0.01, 0.001), Enumerable.Empty <HydraulicBoundaryLocation>(), new[] { dikeProfile }); // Call var successful = false; void Call() => successful = importer.Import(); // Assert const string expectedMessage = "Het opgegeven dijkprofiel 'Dijkprofiel ID' heeft geen voorlandgeometrie en kan daarom niet gebruikt worden. Berekening 'Berekening 1' is overgeslagen."; TestHelper.AssertLogMessageIsGenerated(Call, expectedMessage, 2); Assert.IsTrue(successful); CollectionAssert.IsEmpty(calculationGroup.Children); }
protected override IEnumerable <DikeProfile> SingleNonUniqueElements() { const string someId = "Dike profile"; yield return(DikeProfileTestFactory.CreateDikeProfile("Standard Dike Profile Name", someId)); yield return(DikeProfileTestFactory.CreateDikeProfile("Other Dike Profile Name", someId)); }
public void RemoveDikeProfile_DikeProfilesNull_ThrowsArgumentNullException() { // Call void Call() => GrassCoverErosionInwardsDataSynchronizationService.RemoveDikeProfile( DikeProfileTestFactory.CreateDikeProfile(), Enumerable.Empty <GrassCoverErosionInwardsCalculation>(), null); // Assert var exception = Assert.Throws <ArgumentNullException>(Call); Assert.AreEqual("dikeProfiles", exception.ParamName); }
public void RemoveDikeProfile_CalculationsNull_ThrowsArgumentNullException() { // Call void Call() => GrassCoverErosionInwardsDataSynchronizationService.RemoveDikeProfile( DikeProfileTestFactory.CreateDikeProfile(), null, new DikeProfileCollection()); // Assert var exception = Assert.Throws <ArgumentNullException>(Call); Assert.AreEqual("calculations", exception.ParamName); }
public void DikeProfile_AlwaysOnChange_NotifyObserverAndCalculationPropertyChanged() { // Setup DikeProfile newProfile = DikeProfileTestFactory.CreateDikeProfile(new Point2D(0.0, 0.0)); var newValue = new DataGridViewComboBoxItemWrapper <DikeProfile>(newProfile); var calculation = new GrassCoverErosionInwardsCalculationScenario(); // Call & Assert SetPropertyAndVerifyNotificationsAndOutputForCalculation(row => row.DikeProfile = newValue, calculation); }
private static void AddGrassCoverErosionInwardsCalculation(AssessmentSection assessmentSection, HydraulicBoundaryLocation hydraulicBoundaryLocation) { assessmentSection.GrassCoverErosionInwards.CalculationsGroup.Children.Add(new GrassCoverErosionInwardsCalculation { InputParameters = { HydraulicBoundaryLocation = hydraulicBoundaryLocation, DikeProfile = DikeProfileTestFactory.CreateDikeProfile() } }); }
public void Text_Always_ReturnDikeProfileName() { // Setup const string profileName = "Random profile name"; DikeProfile dikeProfile = DikeProfileTestFactory.CreateDikeProfile(profileName); // Call string text = info.Text(dikeProfile); // Assert Assert.AreEqual(profileName, text); }
public void Data_SetNewDikeProfileInstance_ReturnCorrectPropertyValues() { // Setup DikeProfile dikeProfile = DikeProfileTestFactory.CreateDikeProfile(); var properties = new DikeProfileDikeGeometryProperties(); // Call properties.Data = dikeProfile; // Assert CollectionAssert.IsEmpty(properties.Coordinates); CollectionAssert.IsEmpty(properties.Roughnesses); }
protected override IEnumerable <DikeProfile> MultipleNonUniqueElements() { const string someId = "Dike profile"; const string someotherId = "Other dike profile"; yield return(DikeProfileTestFactory.CreateDikeProfile("Dike profile Name 1", someId)); yield return(DikeProfileTestFactory.CreateDikeProfile("Dike profile Name 2", someId)); yield return(DikeProfileTestFactory.CreateDikeProfile("Dike profile Name 3", someotherId)); yield return(DikeProfileTestFactory.CreateDikeProfile("Dike profile Name 4", someotherId)); }