Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultRows/GrassCoverSlipOffOutwardsSectionResultRowTest.cs =================================================================== diff -u -r833e75c2d3d73d3b7c63ab12d44edaa3cbb09bf1 -r1a9f5c405a588202fa8f3b2c88305be6d40836b5 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultRows/GrassCoverSlipOffOutwardsSectionResultRowTest.cs (.../GrassCoverSlipOffOutwardsSectionResultRowTest.cs) (revision 833e75c2d3d73d3b7c63ab12d44edaa3cbb09bf1) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultRows/GrassCoverSlipOffOutwardsSectionResultRowTest.cs (.../GrassCoverSlipOffOutwardsSectionResultRowTest.cs) (revision 1a9f5c405a588202fa8f3b2c88305be6d40836b5) @@ -25,6 +25,7 @@ using Core.Common.TestUtil; using NUnit.Framework; using Rhino.Mocks; +using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Calculators; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.TestUtil; using Ringtoets.Common.Forms.TypeConverters; @@ -52,6 +53,9 @@ Assert.IsInstanceOf>(row); Assert.AreEqual(result.SimpleAssessmentResult, row.SimpleAssessmentResult); + Assert.AreEqual(result.DetailedAssessmentResult, row.DetailedAssessmentResult); + Assert.AreEqual(result.TailorMadeAssessmentResult, row.TailorMadeAssessmentResult); + Assert.AreEqual(result.AssessmentLayerTwoA, row.AssessmentLayerTwoA); Assert.AreEqual(result.AssessmentLayerThree, row.AssessmentLayerThree); @@ -60,6 +64,41 @@ } [Test] + public void AssessmentLayerTwoA_AlwaysOnChange_ResultPropertyChanged() + { + // Setup + const AssessmentLayerTwoAResult newValue = AssessmentLayerTwoAResult.Successful; + FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(); + var result = new GrassCoverSlipOffOutwardsFailureMechanismSectionResult(section); + var row = new GrassCoverSlipOffOutwardsSectionResultRow(result); + + // Call + row.AssessmentLayerTwoA = newValue; + + // Assert + Assert.AreEqual(newValue, result.AssessmentLayerTwoA); + } + + [Test] + public void AssessmentLayerThree_AlwaysOnChange_ResultPropertyChanged() + { + // Setup + var random = new Random(21); + double newValue = random.NextDouble(); + FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(); + var result = new GrassCoverSlipOffOutwardsFailureMechanismSectionResult(section); + var row = new GrassCoverSlipOffOutwardsSectionResultRow(result); + + // Call + row.AssessmentLayerThree = (RoundedDouble) newValue; + + // Assert + Assert.AreEqual(newValue, result.AssessmentLayerThree, row.AssessmentLayerThree.GetAccuracy()); + } + + #region Registration + + [Test] public void SimpleAssessmentResult_SetNewValue_NotifyObserversAndPropertyChanged() { // Setup @@ -75,47 +114,77 @@ var result = new GrassCoverSlipOffOutwardsFailureMechanismSectionResult(section); result.Attach(observer); - var row = new GrassCoverSlipOffOutwardsSectionResultRow(result); + using (new AssemblyToolCalculatorFactoryConfig()) + { + var row = new GrassCoverSlipOffOutwardsSectionResultRow(result); - // Call - row.SimpleAssessmentResult = newValue; + // Call + row.SimpleAssessmentResult = newValue; - // Assert - Assert.AreEqual(newValue, result.SimpleAssessmentResult); - mocks.VerifyAll(); + // Assert + Assert.AreEqual(newValue, result.SimpleAssessmentResult); + mocks.VerifyAll(); + } } [Test] - public void AssessmentLayerTwoA_AlwaysOnChange_ResultPropertyChanged() + public void DetailedAssessmentResult_SetNewValue_NotifyObserversAndPropertyChanged() { // Setup - const AssessmentLayerTwoAResult newValue = AssessmentLayerTwoAResult.Successful; + var mocks = new MockRepository(); + var observer = mocks.StrictMock(); + observer.Expect(o => o.UpdateObserver()); + mocks.ReplayAll(); + + var random = new Random(39); + var newValue = random.NextEnumValue(); + FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(); var result = new GrassCoverSlipOffOutwardsFailureMechanismSectionResult(section); - var row = new GrassCoverSlipOffOutwardsSectionResultRow(result); + result.Attach(observer); - // Call - row.AssessmentLayerTwoA = newValue; + using (new AssemblyToolCalculatorFactoryConfig()) + { + var row = new GrassCoverSlipOffOutwardsSectionResultRow(result); - // Assert - Assert.AreEqual(newValue, result.AssessmentLayerTwoA); + // Call + row.DetailedAssessmentResult = newValue; + + // Assert + Assert.AreEqual(newValue, result.DetailedAssessmentResult); + mocks.VerifyAll(); + } } [Test] - public void AssessmentLayerThree_AlwaysOnChange_ResultPropertyChanged() + public void TailorMadeAssessmentResult_SetNewValue_NotifyObserversAndPropertyChanged() { // Setup - var random = new Random(21); - double newValue = random.NextDouble(); + var mocks = new MockRepository(); + var observer = mocks.StrictMock(); + observer.Expect(o => o.UpdateObserver()); + mocks.ReplayAll(); + + var random = new Random(39); + var newValue = random.NextEnumValue(); + FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(); var result = new GrassCoverSlipOffOutwardsFailureMechanismSectionResult(section); - var row = new GrassCoverSlipOffOutwardsSectionResultRow(result); + result.Attach(observer); - // Call - row.AssessmentLayerThree = (RoundedDouble) newValue; + using (new AssemblyToolCalculatorFactoryConfig()) + { + var row = new GrassCoverSlipOffOutwardsSectionResultRow(result); - // Assert - Assert.AreEqual(newValue, result.AssessmentLayerThree, row.AssessmentLayerThree.GetAccuracy()); + // Call + row.TailorMadeAssessmentResult = newValue; + + // Assert + Assert.AreEqual(newValue, result.TailorMadeAssessmentResult); + mocks.VerifyAll(); + } } + + #endregion } } \ No newline at end of file