Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultRows/MacroStabilityOutwardsSectionResultRowTest.cs =================================================================== diff -u -rbe4b9dfe060b0867ceb385a39da8f5db29a45c44 -r6edf272474ba1d21eb852537375459ad84a72bc2 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultRows/MacroStabilityOutwardsSectionResultRowTest.cs (.../MacroStabilityOutwardsSectionResultRowTest.cs) (revision be4b9dfe060b0867ceb385a39da8f5db29a45c44) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultRows/MacroStabilityOutwardsSectionResultRowTest.cs (.../MacroStabilityOutwardsSectionResultRowTest.cs) (revision 6edf272474ba1d21eb852537375459ad84a72bc2) @@ -182,6 +182,48 @@ } [Test] + public void Constructor_AssemblyRan_ReturnCategoryGroups() + { + // Setup + var random = new Random(39); + var failureMechanism = new MacroStabilityOutwardsFailureMechanism(); + + var mocks = new MockRepository(); + IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks); + mocks.ReplayAll(); + + FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(); + var result = new MacroStabilityOutwardsFailureMechanismSectionResult(section); + + using (new AssemblyToolCalculatorFactoryConfig()) + { + var calculatorfactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance; + FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorfactory.LastCreatedFailureMechanismSectionAssemblyCalculator; + calculator.SimpleAssessmentAssemblyOutput = new FailureMechanismSectionAssembly( + random.NextDouble(), + random.NextEnumValue()); + calculator.DetailedAssessmentAssemblyOutput = new FailureMechanismSectionAssembly( + random.NextDouble(), + random.NextEnumValue()); + calculator.TailorMadeAssessmentAssemblyOutput = new FailureMechanismSectionAssembly( + random.NextDouble(), + random.NextEnumValue()); + calculator.CombinedAssemblyCategoryOutput = random.NextEnumValue(); + + // Call + var row = new MacroStabilityOutwardsSectionResultRow(result, failureMechanism, assessmentSection, + ConstructionProperties); + + // Assert + Assert.AreEqual(calculator.SimpleAssessmentAssemblyOutput.Group, row.SimpleAssemblyCategoryGroup); + Assert.AreEqual(calculator.DetailedAssessmentAssemblyOutput.Group, row.DetailedAssemblyCategoryGroup); + Assert.AreEqual(calculator.TailorMadeAssessmentAssemblyOutput.Group, row.TailorMadeAssemblyCategoryGroup); + Assert.AreEqual(calculator.CombinedAssemblyCategoryOutput, row.CombinedAssemblyCategoryGroup); + mocks.VerifyAll(); + } + } + + [Test] public void Constructor_AssemblyThrowsException_ThrowsAssemblyException() { // Setup @@ -276,6 +318,32 @@ } } + private static void AssertColumnState(DataGridViewColumnStateDefinition columnStateDefinition, bool cellsEnabled) + { + if (cellsEnabled) + { + AssertColumnStateIsEnabled(columnStateDefinition); + } + else + { + AssertColumnStateIsDisabled(columnStateDefinition); + } + } + + private static void AssertColumnStateIsDisabled(DataGridViewColumnStateDefinition columnStateDefinition) + { + Assert.AreEqual(CellStyle.Disabled, columnStateDefinition.Style); + Assert.IsTrue(columnStateDefinition.ReadOnly); + Assert.AreEqual(string.Empty, columnStateDefinition.ErrorText); + } + + private static void AssertColumnStateIsEnabled(DataGridViewColumnStateDefinition columnStateDefinition) + { + Assert.AreEqual(CellStyle.Enabled, columnStateDefinition.Style); + Assert.IsFalse(columnStateDefinition.ReadOnly); + Assert.AreEqual(string.Empty, columnStateDefinition.ErrorText); + } + #region Column States [Test] @@ -432,32 +500,6 @@ } } - private static void AssertColumnState(DataGridViewColumnStateDefinition columnStateDefinition, bool cellsEnabled) - { - if (cellsEnabled) - { - AssertColumnStateIsEnabled(columnStateDefinition); - } - else - { - AssertColumnStateIsDisabled(columnStateDefinition); - } - } - - private static void AssertColumnStateIsDisabled(DataGridViewColumnStateDefinition columnStateDefinition) - { - Assert.AreEqual(CellStyle.Disabled, columnStateDefinition.Style); - Assert.IsTrue(columnStateDefinition.ReadOnly); - Assert.AreEqual(string.Empty, columnStateDefinition.ErrorText); - } - - private static void AssertColumnStateIsEnabled(DataGridViewColumnStateDefinition columnStateDefinition) - { - Assert.AreEqual(CellStyle.Enabled, columnStateDefinition.Style); - Assert.IsFalse(columnStateDefinition.ReadOnly); - Assert.AreEqual(string.Empty, columnStateDefinition.ErrorText); - } - #endregion #region Registration @@ -700,133 +742,5 @@ } #endregion - - #region Assembly Results - - [Test] - public void SimpleAssemblyCategoryGroup_AssemblyRan_ReturnCategoryGroup() - { - // Setup - var failureMechanism = new MacroStabilityOutwardsFailureMechanism(); - - var mocks = new MockRepository(); - IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks); - mocks.ReplayAll(); - - FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(); - var result = new MacroStabilityOutwardsFailureMechanismSectionResult(section); - - using (new AssemblyToolCalculatorFactoryConfig()) - { - var row = new MacroStabilityOutwardsSectionResultRow(result, failureMechanism, assessmentSection, - ConstructionProperties); - - var calculatorfactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance; - FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorfactory.LastCreatedFailureMechanismSectionAssemblyCalculator; - - // Call - FailureMechanismSectionAssemblyCategoryGroup simpleAssemblyCategoryGroup = row.SimpleAssemblyCategoryGroup; - - // Assert - FailureMechanismSectionAssembly calculatorOutput = calculator.SimpleAssessmentAssemblyOutput; - Assert.AreEqual(calculatorOutput.Group, simpleAssemblyCategoryGroup); - mocks.VerifyAll(); - } - } - - [Test] - public void DetailedAssemblyCategoryGroup_AssemblyRan_ReturnCategoryGroup() - { - // Setup - var failureMechanism = new MacroStabilityOutwardsFailureMechanism(); - - var mocks = new MockRepository(); - IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks); - mocks.ReplayAll(); - - FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(); - var result = new MacroStabilityOutwardsFailureMechanismSectionResult(section); - - using (new AssemblyToolCalculatorFactoryConfig()) - { - var row = new MacroStabilityOutwardsSectionResultRow(result, failureMechanism, assessmentSection, - ConstructionProperties); - - var calculatorfactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance; - FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorfactory.LastCreatedFailureMechanismSectionAssemblyCalculator; - - // Call - FailureMechanismSectionAssemblyCategoryGroup detailedAssemblyCategoryGroup = row.DetailedAssemblyCategoryGroup; - - // Assert - FailureMechanismSectionAssembly calculatorOutput = calculator.DetailedAssessmentAssemblyOutput; - Assert.AreEqual(calculatorOutput.Group, detailedAssemblyCategoryGroup); - mocks.VerifyAll(); - } - } - - [Test] - public void TailorMadeAssemblyCategoryGroup_AssemblyRan_ReturnCategoryGroup() - { - // Setup - var failureMechanism = new MacroStabilityOutwardsFailureMechanism(); - - var mocks = new MockRepository(); - IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks); - mocks.ReplayAll(); - - FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(); - var result = new MacroStabilityOutwardsFailureMechanismSectionResult(section); - - using (new AssemblyToolCalculatorFactoryConfig()) - { - var row = new MacroStabilityOutwardsSectionResultRow(result, failureMechanism, assessmentSection, - ConstructionProperties); - - var calculatorfactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance; - FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorfactory.LastCreatedFailureMechanismSectionAssemblyCalculator; - - // Call - FailureMechanismSectionAssemblyCategoryGroup tailorMadeAssemblyCategoryGroup = row.TailorMadeAssemblyCategoryGroup; - - // Assert - FailureMechanismSectionAssembly calculatorOutput = calculator.TailorMadeAssessmentAssemblyOutput; - Assert.AreEqual(calculatorOutput.Group, tailorMadeAssemblyCategoryGroup); - mocks.VerifyAll(); - } - } - - [Test] - public void CombinedAssemblyCategoryGroup_AssemblyRan_ReturnCategoryGroup() - { - // Setup - var failureMechanism = new MacroStabilityOutwardsFailureMechanism(); - - var mocks = new MockRepository(); - IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks); - mocks.ReplayAll(); - - FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(); - var result = new MacroStabilityOutwardsFailureMechanismSectionResult(section); - - using (new AssemblyToolCalculatorFactoryConfig()) - { - var row = new MacroStabilityOutwardsSectionResultRow(result, failureMechanism, assessmentSection, - ConstructionProperties); - - var calculatorfactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance; - FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorfactory.LastCreatedFailureMechanismSectionAssemblyCalculator; - - // Call - FailureMechanismSectionAssemblyCategoryGroup combinedAssemblyCategoryGroup = row.CombinedAssemblyCategoryGroup; - - // Assert - FailureMechanismSectionAssemblyCategoryGroup calculatorOutput = calculator.CombinedAssemblyCategoryOutput; - Assert.AreEqual(calculatorOutput, combinedAssemblyCategoryGroup); - mocks.VerifyAll(); - } - } - - #endregion } } \ No newline at end of file