private static void AssertCombinedFailureMechanismSectionAssemblyResultMapData(IEnumerable <CombinedFailureMechanismSectionAssemblyResult> expectedAssemblyResults, ReferenceLine referenceLine, MapData mapData) { Assert.IsInstanceOf <MapLineData>(mapData); var assemblyResultMapData = (MapLineData)mapData; int expectedNrOfResults = expectedAssemblyResults.Count(); IEnumerable <MapFeature> mapFeatures = assemblyResultMapData.Features; Assert.AreEqual(expectedNrOfResults, mapFeatures.Count()); for (var i = 0; i < expectedNrOfResults; i++) { CombinedFailureMechanismSectionAssemblyResult expectedAssemblyResult = expectedAssemblyResults.ElementAt(i); MapFeature actualFeature = mapFeatures.ElementAt(i); MapGeometry mapGeometry = actualFeature.MapGeometries.Single(); AssertEqualPointCollections(referenceLine, expectedAssemblyResult, mapGeometry); Assert.AreEqual(1, actualFeature.MetaData.Keys.Count); Assert.AreEqual(EnumDisplayNameHelper.GetDisplayName(expectedAssemblyResult.TotalResult), mapFeatures.ElementAt(i).MetaData["Duidingsklasse"]); } }
private static void AssertExportableCombinedFailureMechanismSectionResult(CombinedFailureMechanismSectionAssemblyResult expectedSection, ExportableCombinedFailureMechanismSection actualSection, ExportableCombinedSectionAssembly actualSectionResult, bool hasAssemblyGroupResults) { Assert.AreSame(actualSection, actualSectionResult.Section); Assert.AreEqual(expectedSection.TotalResult, actualSectionResult.CombinedSectionAssemblyResult.AssemblyGroup); Assert.AreEqual(ExportableAssemblyMethodFactory.Create(expectedSection.CombinedSectionResultAssemblyMethod), actualSectionResult.CombinedSectionAssemblyResult.AssemblyGroupAssemblyMethod); IEnumerable <ExportableFailureMechanismCombinedSectionAssemblyResult> failureMechanismCombinedSectionResults = actualSectionResult.FailureMechanismResults; if (!hasAssemblyGroupResults) { CollectionAssert.IsEmpty(failureMechanismCombinedSectionResults); return; } Assert.AreEqual(17, failureMechanismCombinedSectionResults.Count()); Assert.IsTrue(failureMechanismCombinedSectionResults.All(result => result.SectionAssemblyResult.AssemblyMethod == ExportableAssemblyMethodFactory.Create( expectedSection.FailureMechanismResultsAssemblyMethod))); AssertSubSection(expectedSection.Piping, "STPH", ExportableFailureMechanismType.Generic, failureMechanismCombinedSectionResults.ElementAt(0)); AssertSubSection(expectedSection.GrassCoverErosionInwards, "GEKB", ExportableFailureMechanismType.Generic, failureMechanismCombinedSectionResults.ElementAt(1)); AssertSubSection(expectedSection.MacroStabilityInwards, "STBI", ExportableFailureMechanismType.Generic, failureMechanismCombinedSectionResults.ElementAt(2)); AssertSubSection(expectedSection.Microstability, "STMI", ExportableFailureMechanismType.Generic, failureMechanismCombinedSectionResults.ElementAt(3)); AssertSubSection(expectedSection.StabilityStoneCover, "ZST", ExportableFailureMechanismType.Generic, failureMechanismCombinedSectionResults.ElementAt(4)); AssertSubSection(expectedSection.WaveImpactAsphaltCover, "AGK", ExportableFailureMechanismType.Generic, failureMechanismCombinedSectionResults.ElementAt(5)); AssertSubSection(expectedSection.WaterPressureAsphaltCover, "AWO", ExportableFailureMechanismType.Generic, failureMechanismCombinedSectionResults.ElementAt(6)); AssertSubSection(expectedSection.GrassCoverErosionOutwards, "GEBU", ExportableFailureMechanismType.Generic, failureMechanismCombinedSectionResults.ElementAt(7)); AssertSubSection(expectedSection.GrassCoverSlipOffOutwards, "GABU", ExportableFailureMechanismType.Generic, failureMechanismCombinedSectionResults.ElementAt(8)); AssertSubSection(expectedSection.GrassCoverSlipOffInwards, "GABI", ExportableFailureMechanismType.Generic, failureMechanismCombinedSectionResults.ElementAt(9)); AssertSubSection(expectedSection.HeightStructures, "HTKW", ExportableFailureMechanismType.Generic, failureMechanismCombinedSectionResults.ElementAt(10)); AssertSubSection(expectedSection.ClosingStructures, "BSKW", ExportableFailureMechanismType.Generic, failureMechanismCombinedSectionResults.ElementAt(11)); AssertSubSection(expectedSection.PipingStructure, "PKW", ExportableFailureMechanismType.Generic, failureMechanismCombinedSectionResults.ElementAt(12)); AssertSubSection(expectedSection.StabilityPointStructures, "STKWp", ExportableFailureMechanismType.Generic, failureMechanismCombinedSectionResults.ElementAt(13)); AssertSubSection(expectedSection.DuneErosion, "DA", ExportableFailureMechanismType.Generic, failureMechanismCombinedSectionResults.ElementAt(14)); AssertSubSection(expectedSection.SpecificFailureMechanisms[0], "Nieuw1", ExportableFailureMechanismType.Specific, failureMechanismCombinedSectionResults.ElementAt(15)); AssertSubSection(expectedSection.SpecificFailureMechanisms[1], "Nieuw2", ExportableFailureMechanismType.Specific, failureMechanismCombinedSectionResults.ElementAt(16)); }
private static void AssertEqualPointCollections(ReferenceLine referenceLine, CombinedFailureMechanismSectionAssemblyResult sectionAssemblyResult, MapGeometry geometry) { IEnumerable <Point2D> expectedGeometry = FailureMechanismSectionHelper.GetFailureMechanismSectionGeometry( referenceLine, sectionAssemblyResult.SectionStart, sectionAssemblyResult.SectionEnd).ToArray(); CollectionAssert.IsNotEmpty(expectedGeometry); CollectionAssert.AreEqual(expectedGeometry, geometry.PointCollections.Single()); }
public void CreateCombinedFailureMechanismSectionAssemblyFeatures_WithAssessmentSection_ReturnsFeatureCollection() { // Setup var random = new Random(21); var assessmentSection = new AssessmentSection(random.NextEnumValue <AssessmentSectionComposition>()); assessmentSection.ReferenceLine.SetGeometry(new[] { new Point2D(0, 0), new Point2D(2, 2) }); using (new AssemblyToolCalculatorFactoryConfig()) { var calculatorFactory = (TestAssemblyToolCalculatorFactory)AssemblyToolCalculatorFactory.Instance; AssessmentSectionAssemblyCalculatorStub calculator = calculatorFactory.LastCreatedAssessmentSectionAssemblyCalculator; CombinedFailureMechanismSectionAssembly[] failureMechanismSectionAssembly = { CombinedFailureMechanismSectionAssemblyTestFactory.Create(assessmentSection, 20), CombinedFailureMechanismSectionAssemblyTestFactory.Create(assessmentSection, 21) }; calculator.CombinedFailureMechanismSectionAssemblyOutput = new CombinedFailureMechanismSectionAssemblyResultWrapper( failureMechanismSectionAssembly, AssemblyMethod.BOI3A1, AssemblyMethod.BOI3B1, AssemblyMethod.BOI3C1); // Call IEnumerable <MapFeature> features = AssessmentSectionAssemblyMapDataFeaturesFactory.CreateCombinedFailureMechanismSectionAssemblyFeatures(assessmentSection); // Assert IEnumerable <CombinedFailureMechanismSectionAssemblyResult> expectedAssemblyResults = AssessmentSectionAssemblyFactory.AssembleCombinedPerFailureMechanismSection(assessmentSection); int expectedNrOfResults = expectedAssemblyResults.Count(); Assert.AreEqual(expectedNrOfResults, features.Count()); for (var i = 0; i < expectedNrOfResults; i++) { CombinedFailureMechanismSectionAssemblyResult expectedAssemblyResult = expectedAssemblyResults.ElementAt(i); MapFeature actualFeature = features.ElementAt(i); MapGeometry mapGeometry = actualFeature.MapGeometries.Single(); AssertEqualPointCollections(assessmentSection.ReferenceLine, expectedAssemblyResult, mapGeometry); Assert.AreEqual(1, actualFeature.MetaData.Keys.Count); Assert.AreEqual(EnumDisplayNameHelper.GetDisplayName(expectedAssemblyResult.TotalResult), features.ElementAt(i).MetaData["Duidingsklasse"]); } } }
private static void AssertExportableCombinedFailureMechanismSection(CombinedFailureMechanismSectionAssemblyResult expectedSection, ExportableCombinedFailureMechanismSection actualSection, ReferenceLine referenceLine) { IEnumerable <Point2D> expectedGeometry = FailureMechanismSectionHelper.GetFailureMechanismSectionGeometry( referenceLine, actualSection.StartDistance, actualSection.EndDistance).ToArray(); CollectionAssert.IsNotEmpty(expectedGeometry); Assert.AreEqual(expectedSection.SectionStart, actualSection.StartDistance); Assert.AreEqual(expectedSection.SectionEnd, actualSection.EndDistance); CollectionAssert.AreEqual(expectedGeometry, actualSection.Geometry); Assert.AreEqual(ExportableAssemblyMethodFactory.Create(expectedSection.CommonSectionAssemblyMethod), actualSection.AssemblyMethod); }
/// <summary> /// Creates a new instance of <see cref="CombinedFailureMechanismSectionAssemblyResultRow"/>. /// </summary> /// <param name="combinedFailureMechanismSectionAssemblyResult">The <see cref="CombinedFailureMechanismSectionAssemblyResult"/> /// to wrap so that it can be displayed as a row.</param> /// <exception cref="ArgumentNullException">Thrown when <paramref name="combinedFailureMechanismSectionAssemblyResult"/> /// is <c>null</c>.</exception> public CombinedFailureMechanismSectionAssemblyResultRow( CombinedFailureMechanismSectionAssemblyResult combinedFailureMechanismSectionAssemblyResult) { if (combinedFailureMechanismSectionAssemblyResult == null) { throw new ArgumentNullException(nameof(combinedFailureMechanismSectionAssemblyResult)); } this.combinedFailureMechanismSectionAssemblyResult = combinedFailureMechanismSectionAssemblyResult; totalResultIndex = specificFailureMechanismStartIndex + SpecificFailureMechanisms.Length; ColumnStateDefinitions = new Dictionary <int, DataGridViewColumnStateDefinition>(); CreateColumnStateDefinitions(); SetColumnStateDefinitionColors(); }
private static IEnumerable <ExportableFailureMechanismCombinedSectionAssemblyResult> CreateFailureMechanismCombinedSectionAssemblyResults( CombinedFailureMechanismSectionAssemblyResult assemblyResult, AssessmentSection assessmentSection) { Tuple <FailureMechanismSectionAssemblyGroup?, string, string>[] failureMechanisms = { CreateTuple(assemblyResult.Piping, assessmentSection.Piping), CreateTuple(assemblyResult.GrassCoverErosionInwards, assessmentSection.GrassCoverErosionInwards), CreateTuple(assemblyResult.MacroStabilityInwards, assessmentSection.MacroStabilityInwards), CreateTuple(assemblyResult.Microstability, assessmentSection.Microstability), CreateTuple(assemblyResult.StabilityStoneCover, assessmentSection.StabilityStoneCover), CreateTuple(assemblyResult.WaveImpactAsphaltCover, assessmentSection.WaveImpactAsphaltCover), CreateTuple(assemblyResult.WaterPressureAsphaltCover, assessmentSection.WaterPressureAsphaltCover), CreateTuple(assemblyResult.GrassCoverErosionOutwards, assessmentSection.GrassCoverErosionOutwards), CreateTuple(assemblyResult.GrassCoverSlipOffOutwards, assessmentSection.GrassCoverSlipOffOutwards), CreateTuple(assemblyResult.GrassCoverSlipOffInwards, assessmentSection.GrassCoverSlipOffInwards), CreateTuple(assemblyResult.HeightStructures, assessmentSection.HeightStructures), CreateTuple(assemblyResult.ClosingStructures, assessmentSection.ClosingStructures), CreateTuple(assemblyResult.PipingStructure, assessmentSection.PipingStructure), CreateTuple(assemblyResult.StabilityPointStructures, assessmentSection.StabilityPointStructures), CreateTuple(assemblyResult.DuneErosion, assessmentSection.DuneErosion) }; List <ExportableFailureMechanismCombinedSectionAssemblyResult> exportableAssemblyResults = failureMechanisms.Where(fm => fm.Item1.HasValue) .Select(fm => CreateExportableFailureMechanismCombinedSectionAssemblyResult( fm.Item1.Value, assemblyResult.FailureMechanismResultsAssemblyMethod, ExportableFailureMechanismType.Generic, fm.Item2, fm.Item3)) .ToList(); for (var i = 0; i < assessmentSection.SpecificFailureMechanisms.Count; i++) { FailureMechanismSectionAssemblyGroup?specificFailureMechanismAssemblyResult = assemblyResult.SpecificFailureMechanisms[i]; if (specificFailureMechanismAssemblyResult.HasValue) { SpecificFailureMechanism specificFailureMechanism = assessmentSection.SpecificFailureMechanisms.ElementAt(i); exportableAssemblyResults.Add(CreateExportableFailureMechanismCombinedSectionAssemblyResult( specificFailureMechanismAssemblyResult.Value, assemblyResult.FailureMechanismResultsAssemblyMethod, ExportableFailureMechanismType.Specific, specificFailureMechanism.Code, specificFailureMechanism.Name)); } } return(exportableAssemblyResults); }
private static void AssertCombinedFailureMechanismSectionAssemblyResults(IEnumerable <CombinedFailureMechanismSectionAssemblyResult> assemblyResults, IEnumerable <ExportableCombinedSectionAssembly> exportableCombinedSectionAssemblies, ReferenceLine referenceLine, bool hasAssemblyGroupResults) { int expectedNrOfSections = assemblyResults.Count(); Assert.AreEqual(expectedNrOfSections, exportableCombinedSectionAssemblies.Count()); for (var i = 0; i < expectedNrOfSections; i++) { CombinedFailureMechanismSectionAssemblyResult combinedFailureMechanismSectionAssemblyResult = assemblyResults.ElementAt(i); ExportableCombinedSectionAssembly exportableCombinedSectionAssembly = exportableCombinedSectionAssemblies.ElementAt(i); AssertExportableCombinedFailureMechanismSection(combinedFailureMechanismSectionAssemblyResult, exportableCombinedSectionAssembly.Section, referenceLine); AssertExportableCombinedFailureMechanismSectionResult( combinedFailureMechanismSectionAssemblyResult, exportableCombinedSectionAssembly.Section, exportableCombinedSectionAssembly, hasAssemblyGroupResults); } }
public void Constructor_WithEmptyConstructionProperties_ExpectedValues() { // Setup var random = new Random(21); double sectionStart = random.NextDouble(); double sectionEnd = random.NextDouble(); var totalResult = random.NextEnumValue <FailureMechanismSectionAssemblyGroup>(); var commonSectionAssemblyMethod = random.NextEnumValue <AssemblyMethod>(); var failureMechanismResultsAssemblyMethod = random.NextEnumValue <AssemblyMethod>(); var combinedSectionResultAssemblyMethod = random.NextEnumValue <AssemblyMethod>(); // Call var result = new CombinedFailureMechanismSectionAssemblyResult(sectionStart, sectionEnd, totalResult, commonSectionAssemblyMethod, failureMechanismResultsAssemblyMethod, combinedSectionResultAssemblyMethod, new CombinedFailureMechanismSectionAssemblyResult.ConstructionProperties()); // Assert Assert.AreEqual(sectionStart, result.SectionStart); Assert.AreEqual(sectionEnd, result.SectionEnd); Assert.AreEqual(totalResult, result.TotalResult); Assert.AreEqual(FailureMechanismSectionAssemblyGroup.NoResult, result.Piping); Assert.AreEqual(FailureMechanismSectionAssemblyGroup.NoResult, result.GrassCoverErosionInwards); Assert.AreEqual(FailureMechanismSectionAssemblyGroup.NoResult, result.MacroStabilityInwards); Assert.AreEqual(FailureMechanismSectionAssemblyGroup.NoResult, result.Microstability); Assert.AreEqual(FailureMechanismSectionAssemblyGroup.NoResult, result.StabilityStoneCover); Assert.AreEqual(FailureMechanismSectionAssemblyGroup.NoResult, result.WaveImpactAsphaltCover); Assert.AreEqual(FailureMechanismSectionAssemblyGroup.NoResult, result.WaterPressureAsphaltCover); Assert.AreEqual(FailureMechanismSectionAssemblyGroup.NoResult, result.GrassCoverErosionOutwards); Assert.AreEqual(FailureMechanismSectionAssemblyGroup.NoResult, result.GrassCoverSlipOffOutwards); Assert.AreEqual(FailureMechanismSectionAssemblyGroup.NoResult, result.GrassCoverSlipOffInwards); Assert.AreEqual(FailureMechanismSectionAssemblyGroup.NoResult, result.HeightStructures); Assert.AreEqual(FailureMechanismSectionAssemblyGroup.NoResult, result.ClosingStructures); Assert.AreEqual(FailureMechanismSectionAssemblyGroup.NoResult, result.PipingStructure); Assert.AreEqual(FailureMechanismSectionAssemblyGroup.NoResult, result.StabilityPointStructures); Assert.AreEqual(FailureMechanismSectionAssemblyGroup.NoResult, result.DuneErosion); Assert.IsEmpty(result.SpecificFailureMechanisms); Assert.AreEqual(result.CommonSectionAssemblyMethod, commonSectionAssemblyMethod); Assert.AreEqual(result.FailureMechanismResultsAssemblyMethod, failureMechanismResultsAssemblyMethod); Assert.AreEqual(result.CombinedSectionResultAssemblyMethod, combinedSectionResultAssemblyMethod); }
public void Constructor_WithConstructionPropertiesRepresentingAllFailureMechanismsInAssembly_ExpectedValues() { // Setup var random = new Random(21); double sectionStart = random.NextDouble(); double sectionEnd = random.NextDouble(); var totalResult = random.NextEnumValue <FailureMechanismSectionAssemblyGroup>(); var pipingResult = random.NextEnumValue <FailureMechanismSectionAssemblyGroup>(); var grassCoverErosionInwardsResult = random.NextEnumValue <FailureMechanismSectionAssemblyGroup>(); var macroStabilityInwardsResult = random.NextEnumValue <FailureMechanismSectionAssemblyGroup>(); var microstabilityResult = random.NextEnumValue <FailureMechanismSectionAssemblyGroup>(); var stabilityStoneCoverResult = random.NextEnumValue <FailureMechanismSectionAssemblyGroup>(); var waveImpactAsphaltCoverResult = random.NextEnumValue <FailureMechanismSectionAssemblyGroup>(); var waterPressureAsphaltCoverResult = random.NextEnumValue <FailureMechanismSectionAssemblyGroup>(); var grassCoverErosionOutwardsResult = random.NextEnumValue <FailureMechanismSectionAssemblyGroup>(); var grassCoverSlipOffOutwardsResult = random.NextEnumValue <FailureMechanismSectionAssemblyGroup>(); var grassCoverSlipOffInwardsResult = random.NextEnumValue <FailureMechanismSectionAssemblyGroup>(); var heightStructuresResult = random.NextEnumValue <FailureMechanismSectionAssemblyGroup>(); var closingStructuresResult = random.NextEnumValue <FailureMechanismSectionAssemblyGroup>(); var pipingStructureResult = random.NextEnumValue <FailureMechanismSectionAssemblyGroup>(); var stabilityPointStructuresResult = random.NextEnumValue <FailureMechanismSectionAssemblyGroup>(); var duneErosionResult = random.NextEnumValue <FailureMechanismSectionAssemblyGroup>(); var specificFailureMechanismResults = new FailureMechanismSectionAssemblyGroup?[] { random.NextEnumValue <FailureMechanismSectionAssemblyGroup>(), random.NextEnumValue <FailureMechanismSectionAssemblyGroup>(), random.NextEnumValue <FailureMechanismSectionAssemblyGroup>() }; var commonSectionAssemblyMethod = random.NextEnumValue <AssemblyMethod>(); var failureMechanismResultsAssemblyMethod = random.NextEnumValue <AssemblyMethod>(); var combinedSectionResultAssemblyMethod = random.NextEnumValue <AssemblyMethod>(); // Call var result = new CombinedFailureMechanismSectionAssemblyResult(sectionStart, sectionEnd, totalResult, commonSectionAssemblyMethod, failureMechanismResultsAssemblyMethod, combinedSectionResultAssemblyMethod, new CombinedFailureMechanismSectionAssemblyResult.ConstructionProperties { Piping = pipingResult, GrassCoverErosionInwards = grassCoverErosionInwardsResult, MacroStabilityInwards = macroStabilityInwardsResult, Microstability = microstabilityResult, StabilityStoneCover = stabilityStoneCoverResult, WaveImpactAsphaltCover = waveImpactAsphaltCoverResult, WaterPressureAsphaltCover = waterPressureAsphaltCoverResult, GrassCoverErosionOutwards = grassCoverErosionOutwardsResult, GrassCoverSlipOffOutwards = grassCoverSlipOffOutwardsResult, GrassCoverSlipOffInwards = grassCoverSlipOffInwardsResult, HeightStructures = heightStructuresResult, ClosingStructures = closingStructuresResult, PipingStructure = pipingStructureResult, StabilityPointStructures = stabilityPointStructuresResult, DuneErosion = duneErosionResult, SpecificFailureMechanisms = specificFailureMechanismResults }); // Assert Assert.AreEqual(sectionStart, result.SectionStart); Assert.AreEqual(sectionEnd, result.SectionEnd); Assert.AreEqual(totalResult, result.TotalResult); Assert.AreEqual(pipingResult, result.Piping); Assert.AreEqual(grassCoverErosionInwardsResult, result.GrassCoverErosionInwards); Assert.AreEqual(macroStabilityInwardsResult, result.MacroStabilityInwards); Assert.AreEqual(microstabilityResult, result.Microstability); Assert.AreEqual(stabilityStoneCoverResult, result.StabilityStoneCover); Assert.AreEqual(waveImpactAsphaltCoverResult, result.WaveImpactAsphaltCover); Assert.AreEqual(waterPressureAsphaltCoverResult, result.WaterPressureAsphaltCover); Assert.AreEqual(grassCoverErosionOutwardsResult, result.GrassCoverErosionOutwards); Assert.AreEqual(grassCoverSlipOffOutwardsResult, result.GrassCoverSlipOffOutwards); Assert.AreEqual(grassCoverSlipOffInwardsResult, result.GrassCoverSlipOffInwards); Assert.AreEqual(heightStructuresResult, result.HeightStructures); Assert.AreEqual(closingStructuresResult, result.ClosingStructures); Assert.AreEqual(pipingStructureResult, result.PipingStructure); Assert.AreEqual(stabilityPointStructuresResult, result.StabilityPointStructures); Assert.AreEqual(duneErosionResult, result.DuneErosion); CollectionAssert.AreEqual(specificFailureMechanismResults, result.SpecificFailureMechanisms); Assert.AreEqual(result.CommonSectionAssemblyMethod, commonSectionAssemblyMethod); Assert.AreEqual(result.FailureMechanismResultsAssemblyMethod, failureMechanismResultsAssemblyMethod); Assert.AreEqual(result.CombinedSectionResultAssemblyMethod, combinedSectionResultAssemblyMethod); }
public void Constructor_WithConstructionPropertiesRepresentingAllFailureMechanismsNotInAssembly_ExpectedValues() { // Setup var random = new Random(21); double sectionStart = random.NextDouble(); double sectionEnd = random.NextDouble(); var totalResult = random.NextEnumValue <FailureMechanismSectionAssemblyGroup>(); var specificFailureMechanismResults = new FailureMechanismSectionAssemblyGroup?[] { null, null, null }; var commonSectionAssemblyMethod = random.NextEnumValue <AssemblyMethod>(); var failureMechanismResultsAssemblyMethod = random.NextEnumValue <AssemblyMethod>(); var combinedSectionResultAssemblyMethod = random.NextEnumValue <AssemblyMethod>(); // Call var result = new CombinedFailureMechanismSectionAssemblyResult(sectionStart, sectionEnd, totalResult, commonSectionAssemblyMethod, failureMechanismResultsAssemblyMethod, combinedSectionResultAssemblyMethod, new CombinedFailureMechanismSectionAssemblyResult.ConstructionProperties { Piping = null, GrassCoverErosionInwards = null, MacroStabilityInwards = null, Microstability = null, StabilityStoneCover = null, WaveImpactAsphaltCover = null, WaterPressureAsphaltCover = null, GrassCoverErosionOutwards = null, GrassCoverSlipOffOutwards = null, GrassCoverSlipOffInwards = null, HeightStructures = null, ClosingStructures = null, PipingStructure = null, StabilityPointStructures = null, DuneErosion = null, SpecificFailureMechanisms = specificFailureMechanismResults }); // Assert Assert.AreEqual(sectionStart, result.SectionStart); Assert.AreEqual(sectionEnd, result.SectionEnd); Assert.AreEqual(totalResult, result.TotalResult); Assert.IsNull(result.Piping); Assert.IsNull(result.GrassCoverErosionInwards); Assert.IsNull(result.MacroStabilityInwards); Assert.IsNull(result.Microstability); Assert.IsNull(result.StabilityStoneCover); Assert.IsNull(result.WaveImpactAsphaltCover); Assert.IsNull(result.WaterPressureAsphaltCover); Assert.IsNull(result.GrassCoverErosionOutwards); Assert.IsNull(result.GrassCoverSlipOffOutwards); Assert.IsNull(result.GrassCoverSlipOffInwards); Assert.IsNull(result.HeightStructures); Assert.IsNull(result.ClosingStructures); Assert.IsNull(result.PipingStructure); Assert.IsNull(result.StabilityPointStructures); Assert.IsNull(result.DuneErosion); Assert.AreEqual(specificFailureMechanismResults.Length, result.SpecificFailureMechanisms.Length); foreach (FailureMechanismSectionAssemblyGroup?specificFailureMechanismResult in result.SpecificFailureMechanisms) { Assert.IsNull(specificFailureMechanismResult); } Assert.AreEqual(result.CommonSectionAssemblyMethod, commonSectionAssemblyMethod); Assert.AreEqual(result.FailureMechanismResultsAssemblyMethod, failureMechanismResultsAssemblyMethod); Assert.AreEqual(result.CombinedSectionResultAssemblyMethod, combinedSectionResultAssemblyMethod); }
public void Constructor_WithCombinedFailureMechanismAssemblyResult_ExpectedValues(bool failureMechanismsInAssembly) { // Setup CombinedFailureMechanismSectionAssemblyResult result = GetCombinedFailureMechanismSectionAssemblyResult(failureMechanismsInAssembly); // Call var row = new CombinedFailureMechanismSectionAssemblyResultRow(result); // Assert Assert.IsInstanceOf <IHasColumnStateDefinitions>(row); IDictionary <int, DataGridViewColumnStateDefinition> columnStateDefinitions = row.ColumnStateDefinitions; Assert.AreEqual(19, columnStateDefinitions.Count); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnStateDefinition(columnStateDefinitions, pipingIndex); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnStateDefinition(columnStateDefinitions, grassCoverErosionInwardsIndex); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnStateDefinition(columnStateDefinitions, macroStabilityInwardsIndex); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnStateDefinition(columnStateDefinitions, microstabililityIndex); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnStateDefinition(columnStateDefinitions, stabilityStoneCoverIndex); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnStateDefinition(columnStateDefinitions, waveImpactAsphaltCoverIndex); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnStateDefinition(columnStateDefinitions, waterPressureAsphaltCoverIndex); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnStateDefinition(columnStateDefinitions, grassCoverErosionOutwardsIndex); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnStateDefinition(columnStateDefinitions, grassCoverSlipOffOutwardsIndex); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnStateDefinition(columnStateDefinitions, grassCoverSlipOffInwardsIndex); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnStateDefinition(columnStateDefinitions, heightStructuresIndex); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnStateDefinition(columnStateDefinitions, closingStructuresIndex); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnStateDefinition(columnStateDefinitions, pipingStructureIndex); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnStateDefinition(columnStateDefinitions, stabilityPointStructuresIndex); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnStateDefinition(columnStateDefinitions, duneErosionIndex); for (var i = 0; i < result.SpecificFailureMechanisms.Length; i++) { DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnStateDefinition(columnStateDefinitions, specificFailureMechanismStartIndex + i); } DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnStateDefinition(columnStateDefinitions, specificFailureMechanismStartIndex + result.SpecificFailureMechanisms.Length); Assert.AreEqual(2, row.SectionStart.NumberOfDecimalPlaces); Assert.AreEqual(result.SectionStart, row.SectionStart, row.SectionStart.GetAccuracy()); Assert.AreEqual(2, row.SectionStart.NumberOfDecimalPlaces); Assert.AreEqual(result.SectionEnd, row.SectionEnd, row.SectionEnd.GetAccuracy()); Assert.AreEqual(GetExpectedDisplayNameForFailureMechanism(result.Piping), row.Piping); Assert.AreEqual(GetExpectedDisplayNameForFailureMechanism(result.GrassCoverErosionInwards), row.GrassCoverErosionInwards); Assert.AreEqual(GetExpectedDisplayNameForFailureMechanism(result.MacroStabilityInwards), row.MacroStabilityInwards); Assert.AreEqual(GetExpectedDisplayNameForFailureMechanism(result.Microstability), row.Microstability); Assert.AreEqual(GetExpectedDisplayNameForFailureMechanism(result.StabilityStoneCover), row.StabilityStoneCover); Assert.AreEqual(GetExpectedDisplayNameForFailureMechanism(result.WaveImpactAsphaltCover), row.WaveImpactAsphaltCover); Assert.AreEqual(GetExpectedDisplayNameForFailureMechanism(result.WaterPressureAsphaltCover), row.WaterPressureAsphaltCover); Assert.AreEqual(GetExpectedDisplayNameForFailureMechanism(result.GrassCoverErosionOutwards), row.GrassCoverErosionOutwards); Assert.AreEqual(GetExpectedDisplayNameForFailureMechanism(result.GrassCoverSlipOffOutwards), row.GrassCoverSlipOffOutwards); Assert.AreEqual(GetExpectedDisplayNameForFailureMechanism(result.GrassCoverSlipOffInwards), row.GrassCoverSlipOffInwards); Assert.AreEqual(GetExpectedDisplayNameForFailureMechanism(result.HeightStructures), row.HeightStructures); Assert.AreEqual(GetExpectedDisplayNameForFailureMechanism(result.ClosingStructures), row.ClosingStructures); Assert.AreEqual(GetExpectedDisplayNameForFailureMechanism(result.PipingStructure), row.PipingStructure); Assert.AreEqual(GetExpectedDisplayNameForFailureMechanism(result.StabilityPointStructures), row.StabilityPointStructures); Assert.AreEqual(GetExpectedDisplayNameForFailureMechanism(result.DuneErosion), row.DuneErosion); for (var i = 0; i < result.SpecificFailureMechanisms.Length; i++) { FailureMechanismSectionAssemblyGroup?specificFailureMechanism = result.SpecificFailureMechanisms[i]; Assert.AreEqual(GetExpectedDisplayNameForFailureMechanism(specificFailureMechanism), row.SpecificFailureMechanisms[i]); } Assert.AreEqual(EnumDisplayNameHelper.GetDisplayName(result.TotalResult), row.TotalResult); }
public void Constructor_WithCombinedFailureMechanismAssemblyResultContainingOnlyFailureMechanismsNotInAssembly_ExpectedColumnStates() { // Setup var random = new Random(21); var result = new CombinedFailureMechanismSectionAssemblyResult(random.NextDouble(), random.NextDouble(), FailureMechanismSectionAssemblyGroup.NoResult, random.NextEnumValue <AssemblyMethod>(), random.NextEnumValue <AssemblyMethod>(), random.NextEnumValue <AssemblyMethod>(), new CombinedFailureMechanismSectionAssemblyResult.ConstructionProperties { Piping = null, GrassCoverErosionInwards = null, MacroStabilityInwards = null, Microstability = null, StabilityStoneCover = null, WaveImpactAsphaltCover = null, WaterPressureAsphaltCover = null, GrassCoverErosionOutwards = null, GrassCoverSlipOffOutwards = null, GrassCoverSlipOffInwards = null, HeightStructures = null, ClosingStructures = null, PipingStructure = null, StabilityPointStructures = null, DuneErosion = null, SpecificFailureMechanisms = new FailureMechanismSectionAssemblyGroup?[] { null, null } }); // Call var row = new CombinedFailureMechanismSectionAssemblyResultRow(result); // Assert Color expectedBackgroundColor = Color.FromArgb(255, 255, 255); IDictionary <int, DataGridViewColumnStateDefinition> columnStateDefinitions = row.ColumnStateDefinitions; DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnWithColorState(columnStateDefinitions[pipingIndex], expectedBackgroundColor); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnWithColorState(columnStateDefinitions[grassCoverErosionInwardsIndex], expectedBackgroundColor); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnWithColorState(columnStateDefinitions[macroStabilityInwardsIndex], expectedBackgroundColor); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnWithColorState(columnStateDefinitions[microstabililityIndex], expectedBackgroundColor); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnWithColorState(columnStateDefinitions[stabilityStoneCoverIndex], expectedBackgroundColor); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnWithColorState(columnStateDefinitions[waveImpactAsphaltCoverIndex], expectedBackgroundColor); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnWithColorState(columnStateDefinitions[waterPressureAsphaltCoverIndex], expectedBackgroundColor); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnWithColorState(columnStateDefinitions[grassCoverErosionOutwardsIndex], expectedBackgroundColor); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnWithColorState(columnStateDefinitions[grassCoverSlipOffOutwardsIndex], expectedBackgroundColor); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnWithColorState(columnStateDefinitions[grassCoverSlipOffInwardsIndex], expectedBackgroundColor); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnWithColorState(columnStateDefinitions[heightStructuresIndex], expectedBackgroundColor); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnWithColorState(columnStateDefinitions[closingStructuresIndex], expectedBackgroundColor); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnWithColorState(columnStateDefinitions[pipingStructureIndex], expectedBackgroundColor); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnWithColorState(columnStateDefinitions[stabilityPointStructuresIndex], expectedBackgroundColor); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnWithColorState(columnStateDefinitions[duneErosionIndex], expectedBackgroundColor); for (var i = 0; i < result.SpecificFailureMechanisms.Length; i++) { DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnWithColorState(columnStateDefinitions[specificFailureMechanismStartIndex + i], expectedBackgroundColor); } DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnWithColorState(columnStateDefinitions[specificFailureMechanismStartIndex + result.SpecificFailureMechanisms.Length], expectedBackgroundColor); }