Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsFailureMechanismSectionResult.cs =================================================================== diff -u -r219f8633c1b5b24f9e9aec3e903734fa94775f0e -r4d2271ee60b40225ccfeb4a8eadc40c7e0fae357 --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsFailureMechanismSectionResult.cs (.../GrassCoverErosionInwardsFailureMechanismSectionResult.cs) (revision 219f8633c1b5b24f9e9aec3e903734fa94775f0e) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsFailureMechanismSectionResult.cs (.../GrassCoverErosionInwardsFailureMechanismSectionResult.cs) (revision 4d2271ee60b40225ccfeb4a8eadc40c7e0fae357) @@ -31,6 +31,8 @@ /// public class GrassCoverErosionInwardsFailureMechanismSectionResult : FailureMechanismSectionResult { + private readonly RoundedDouble assessmentLayerTwoA; + /// /// Creates a new instance of . /// @@ -42,7 +44,13 @@ /// /// Gets the value of assessment layer two a. /// - public RoundedDouble AssessmentLayerTwoA { get; set; } + public RoundedDouble AssessmentLayerTwoA + { + get + { + return assessmentLayerTwoA; + } + } /// /// Gets or sets the value of assessment layer two b. Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsFailureMechanismResultView.cs =================================================================== diff -u -ra048dc4662f1eb83e4e8cd127790473f01470263 -r4d2271ee60b40225ccfeb4a8eadc40c7e0fae357 --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsFailureMechanismResultView.cs (.../GrassCoverErosionInwardsFailureMechanismResultView.cs) (revision a048dc4662f1eb83e4e8cd127790473f01470263) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsFailureMechanismResultView.cs (.../GrassCoverErosionInwardsFailureMechanismResultView.cs) (revision 4d2271ee60b40225ccfeb4a8eadc40c7e0fae357) @@ -50,8 +50,8 @@ DataGridViewControl.AddCellFormattingHandler(DisableIrrelevantFieldsFormatting); // The concat is needed to observe the input of calculations in child groups. - calculationInputObserver = new RecursiveObserver(UpdataDataGridViewDataSource, cg => cg.Children.Concat(cg.Children.OfType().Select(c => c.GetObservableInput()))); - calculationOutputObserver = new RecursiveObserver(UpdataDataGridViewDataSource, cg => cg.Children.Concat(cg.Children.OfType().Select(c => c.GetObservableOutput()))); + calculationInputObserver = new RecursiveObserver(UpdataDataGridViewDataSource, cg => cg.Children.Concat(cg.Children.OfType().Select(c => c.GetObservableInput()))); + calculationOutputObserver = new RecursiveObserver(UpdataDataGridViewDataSource, cg => cg.Children.Concat(cg.Children.OfType().Select(c => c.GetObservableOutput()))); calculationGroupObserver = new RecursiveObserver(UpdataDataGridViewDataSource, c => c.Children); } Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsFailureMechanismSectionResultRow.cs =================================================================== diff -u -r219f8633c1b5b24f9e9aec3e903734fa94775f0e -r4d2271ee60b40225ccfeb4a8eadc40c7e0fae357 --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsFailureMechanismSectionResultRow.cs (.../GrassCoverErosionInwardsFailureMechanismSectionResultRow.cs) (revision 219f8633c1b5b24f9e9aec3e903734fa94775f0e) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsFailureMechanismSectionResultRow.cs (.../GrassCoverErosionInwardsFailureMechanismSectionResultRow.cs) (revision 4d2271ee60b40225ccfeb4a8eadc40c7e0fae357) @@ -31,6 +31,8 @@ /// internal class GrassCoverErosionInwardsFailureMechanismSectionResultRow { + private readonly GrassCoverErosionInwardsFailureMechanismSectionResult sectionResult; + /// /// Creates a new instance of . /// @@ -44,7 +46,7 @@ { throw new ArgumentNullException("sectionResult"); } - SectionResult = sectionResult; + this.sectionResult = sectionResult; } /// @@ -54,7 +56,7 @@ { get { - return SectionResult.Section.Name; + return sectionResult.Section.Name; } } @@ -65,12 +67,12 @@ { get { - return SectionResult.AssessmentLayerOne; + return sectionResult.AssessmentLayerOne; } set { - SectionResult.AssessmentLayerOne = value; - SectionResult.NotifyObservers(); + sectionResult.AssessmentLayerOne = value; + sectionResult.NotifyObservers(); } } @@ -81,7 +83,7 @@ { get { - return SectionResult.AssessmentLayerTwoA; + return sectionResult.AssessmentLayerTwoA; } } @@ -92,11 +94,11 @@ { get { - return SectionResult.AssessmentLayerTwoB; + return sectionResult.AssessmentLayerTwoB; } set { - SectionResult.AssessmentLayerTwoB = value; + sectionResult.AssessmentLayerTwoB = value; } } @@ -107,14 +109,12 @@ { get { - return SectionResult.AssessmentLayerThree; + return sectionResult.AssessmentLayerThree; } set { - SectionResult.AssessmentLayerThree = value; + sectionResult.AssessmentLayerThree = value; } } - - private GrassCoverErosionInwardsFailureMechanismSectionResult SectionResult { get; set; } } } \ No newline at end of file Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Views/GrassCoverErosionInwardsFailureMechanismResultViewTest.cs =================================================================== diff -u -r219f8633c1b5b24f9e9aec3e903734fa94775f0e -r4d2271ee60b40225ccfeb4a8eadc40c7e0fae357 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Views/GrassCoverErosionInwardsFailureMechanismResultViewTest.cs (.../GrassCoverErosionInwardsFailureMechanismResultViewTest.cs) (revision 219f8633c1b5b24f9e9aec3e903734fa94775f0e) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Views/GrassCoverErosionInwardsFailureMechanismResultViewTest.cs (.../GrassCoverErosionInwardsFailureMechanismResultViewTest.cs) (revision 4d2271ee60b40225ccfeb4a8eadc40c7e0fae357) @@ -32,6 +32,7 @@ using Rhino.Mocks; using Ringtoets.Common.Data.Calculation; using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Forms.Views; using Ringtoets.GrassCoverErosionInwards.Data; using Ringtoets.GrassCoverErosionInwards.Forms.Views; @@ -61,8 +62,7 @@ using (var view = new GrassCoverErosionInwardsFailureMechanismResultView()) { // Assert - Assert.IsInstanceOf(view); - Assert.IsInstanceOf(view); + Assert.IsInstanceOf>(view); Assert.IsNull(view.Data); } } @@ -126,7 +126,7 @@ } [Test] - public void Data_SetOtherThanFailureMechanismSectionResultListData_DataNullAndDataGridViewOneEmtpyRow() + public void Data_SetOtherThanFailureMechanismSectionResultListData_DataNullAndDataGridViewEmtpy() { // Setup var testData = new object(); @@ -184,6 +184,7 @@ { var dataGridView = (DataGridView)new ControlTester("dataGridView").TheObject; + // Call dataGridView.Rows[0].Cells[assessmentLayerOneIndex].Value = checkBoxSelected; // Assert @@ -310,70 +311,6 @@ } } - [Test] - public void FailureMechanismResultView_AssessmentLayerTwoAHasValue_DoesNotShowsErrorTooltip() - { - // Setup - var mocks = new MockRepository(); - - mocks.ReplayAll(); - - var rowIndex = 0; - - using (var view = ShowFullyConfiguredFailureMechanismResultsView()) - { - var sections = (List)view.Data; - sections[0].AssessmentLayerTwoA = (RoundedDouble) 0.2; - - var gridTester = new ControlTester("dataGridView"); - var dataGridView = (DataGridView)gridTester.TheObject; - - DataGridViewCell dataGridViewCell = dataGridView.Rows[rowIndex].Cells[assessmentLayerTwoAIndex]; - - // Call - var formattedValue = dataGridViewCell.FormattedValue; // Need to do this to fire the CellFormatting event. - - // Assert - Assert.AreEqual(string.Empty, dataGridViewCell.ErrorText); - Assert.AreEqual(string.Format("{0}", (RoundedDouble)0.2), formattedValue); - mocks.VerifyAll(); - } - } - - [Test] - public void FailureMechanismResultView_AssessmentLayerTwoANaN_ShowsErrorTooltip() - { - // Setup - var mocks = new MockRepository(); - var calculationScenarioMock = mocks.StrictMock(); - calculationScenarioMock.Stub(cs => cs.Contribution).Return((RoundedDouble)1.0); - calculationScenarioMock.Stub(cs => cs.IsRelevant).Return(true); - calculationScenarioMock.Stub(cs => cs.Status).Return(CalculationScenarioStatus.Failed); - - mocks.ReplayAll(); - - var rowIndex = 0; - - using (var view = ShowFullyConfiguredFailureMechanismResultsView()) - { - var sections = (List)view.Data; - sections[0].AssessmentLayerTwoA = (RoundedDouble)double.NaN; - - var gridTester = new ControlTester("dataGridView"); - var dataGridView = (DataGridView)gridTester.TheObject; - - DataGridViewCell dataGridViewCell = dataGridView.Rows[rowIndex].Cells[assessmentLayerTwoAIndex]; - - // Call - var formattedValue = dataGridViewCell.FormattedValue; // Need to do this to fire the CellFormatting event. - - // Assert - Assert.AreEqual(string.Empty, dataGridViewCell.ErrorText); - Assert.AreEqual(string.Format("{0}", double.NaN), formattedValue); - mocks.VerifyAll(); - } - } - private const int nameColumnIndex = 0; private const int assessmentLayerOneIndex = 1; private const int assessmentLayerTwoAIndex = 2; Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Plugin.Test/ViewInfos/GrassCoverErosionInwardsFailureMechanismResultViewInfoTest.cs =================================================================== diff -u -r219f8633c1b5b24f9e9aec3e903734fa94775f0e -r4d2271ee60b40225ccfeb4a8eadc40c7e0fae357 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Plugin.Test/ViewInfos/GrassCoverErosionInwardsFailureMechanismResultViewInfoTest.cs (.../GrassCoverErosionInwardsFailureMechanismResultViewInfoTest.cs) (revision 219f8633c1b5b24f9e9aec3e903734fa94775f0e) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Plugin.Test/ViewInfos/GrassCoverErosionInwardsFailureMechanismResultViewInfoTest.cs (.../GrassCoverErosionInwardsFailureMechanismResultViewInfoTest.cs) (revision 4d2271ee60b40225ccfeb4a8eadc40c7e0fae357) @@ -59,17 +59,16 @@ public void Initialized_Always_ExpectedPropertiesSet() { // Assert + Assert.AreEqual(typeof(GrassCoverErosionInwardsFailureMechanismResultView), info.ViewType); Assert.AreEqual(typeof(FailureMechanismSectionResultContext), info.DataType); + Assert.AreEqual(typeof(IEnumerable), info.ViewDataType); } [Test] public void GetViewName_Always_ReturnsViewName() { - // Setup - var view = new GrassCoverErosionInwardsFailureMechanismResultView(); - // Call - var viewName = info.GetViewName(view, Enumerable.Empty()); + var viewName = info.GetViewName(null, null); // Assert Assert.AreEqual("Oordeel", viewName); @@ -95,37 +94,6 @@ } [Test] - public void ViewType_Always_ReturnsViewType() - { - // Call - var viewType = info.ViewType; - - // Assert - Assert.AreEqual(typeof(GrassCoverErosionInwardsFailureMechanismResultView), viewType); - } - - [Test] - public void DataType_Always_ReturnsDataType() - { - // Call - var dataType = info.DataType; - - // Assert - Assert.AreEqual(typeof(FailureMechanismSectionResultContext), - dataType); - } - - [Test] - public void ViewDataType_Always_ReturnViewDataType() - { - // Call - var viewDataType = info.ViewDataType; - - // Assert - Assert.AreEqual(typeof(IEnumerable), viewDataType); - } - - [Test] public void Image_Always_ReturnsFailureMechanismSectionResultIcon() { // Call @@ -234,7 +202,7 @@ } [Test] - public void CloseForData_ViewNotCorrespondingToRemovedFailureMechanismContext_ReturnsFalse() + public void CloseForData_ViewNotCorrespondingToRemovedFailureMechanism_ReturnsFalse() { // Setup var failureMechanism = new GrassCoverErosionInwardsFailureMechanism(); @@ -276,7 +244,7 @@ } [Test] - public void CloseForData_ViewNotCorrespondingToRemovedFailureMechanism_ReturnsFalse() + public void CloseForData_ViewNotCorrespondingToRemovedFailureMechanismContext_ReturnsFalse() { // Setup var mocks = new MockRepository(); Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Data/HeightStructuresFailureMechanismSectionResult.cs =================================================================== diff -u -re24eab2c6007074685556ec97dbe45940a520687 -r4d2271ee60b40225ccfeb4a8eadc40c7e0fae357 --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Data/HeightStructuresFailureMechanismSectionResult.cs (.../HeightStructuresFailureMechanismSectionResult.cs) (revision e24eab2c6007074685556ec97dbe45940a520687) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Data/HeightStructuresFailureMechanismSectionResult.cs (.../HeightStructuresFailureMechanismSectionResult.cs) (revision 4d2271ee60b40225ccfeb4a8eadc40c7e0fae357) @@ -31,6 +31,8 @@ /// public class HeightStructuresFailureMechanismSectionResult : FailureMechanismSectionResult { + private readonly RoundedDouble assessmentLayerTwoA; + /// /// Creates a new instance of . /// @@ -41,7 +43,13 @@ /// /// Gets the value of assessment layer two a. /// - public RoundedDouble AssessmentLayerTwoA { get; set; } + public RoundedDouble AssessmentLayerTwoA + { + get + { + return assessmentLayerTwoA; + } + } /// /// Gets or sets the value of assessment layer two b. Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Ringtoets.HeightStructures.Forms.csproj =================================================================== diff -u -rf5ac9de8b45cef4515fa7a051c5af54446f96712 -r4d2271ee60b40225ccfeb4a8eadc40c7e0fae357 --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Ringtoets.HeightStructures.Forms.csproj (.../Ringtoets.HeightStructures.Forms.csproj) (revision f5ac9de8b45cef4515fa7a051c5af54446f96712) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Ringtoets.HeightStructures.Forms.csproj (.../Ringtoets.HeightStructures.Forms.csproj) (revision 4d2271ee60b40225ccfeb4a8eadc40c7e0fae357) @@ -58,9 +58,6 @@ UserControl - - HeightStructuresFailureMechanismResultView.cs - @@ -115,9 +112,6 @@ Resources.Designer.cs Designer - - HeightStructuresFailureMechanismResultView.cs - Fisheye: Tag 4d2271ee60b40225ccfeb4a8eadc40c7e0fae357 refers to a dead (removed) revision in file `Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Views/HeightStructuresFailureMechanismResultView.Designer.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Views/HeightStructuresFailureMechanismResultView.cs =================================================================== diff -u -ra048dc4662f1eb83e4e8cd127790473f01470263 -r4d2271ee60b40225ccfeb4a8eadc40c7e0fae357 --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Views/HeightStructuresFailureMechanismResultView.cs (.../HeightStructuresFailureMechanismResultView.cs) (revision a048dc4662f1eb83e4e8cd127790473f01470263) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Views/HeightStructuresFailureMechanismResultView.cs (.../HeightStructuresFailureMechanismResultView.cs) (revision 4d2271ee60b40225ccfeb4a8eadc40c7e0fae357) @@ -50,8 +50,8 @@ DataGridViewControl.AddCellFormattingHandler(DisableIrrelevantFieldsFormatting); // The concat is needed to observe the input of calculations in child groups. - calculationInputObserver = new RecursiveObserver(UpdataDataGridViewDataSource, cg => cg.Children.Concat(cg.Children.OfType().Select(c => c.GetObservableInput()))); - calculationOutputObserver = new RecursiveObserver(UpdataDataGridViewDataSource, cg => cg.Children.Concat(cg.Children.OfType().Select(c => c.GetObservableOutput()))); + calculationInputObserver = new RecursiveObserver(UpdataDataGridViewDataSource, cg => cg.Children.Concat(cg.Children.OfType().Select(c => c.GetObservableInput()))); + calculationOutputObserver = new RecursiveObserver(UpdataDataGridViewDataSource, cg => cg.Children.Concat(cg.Children.OfType().Select(c => c.GetObservableOutput()))); calculationGroupObserver = new RecursiveObserver(UpdataDataGridViewDataSource, c => c.Children); } Fisheye: Tag 4d2271ee60b40225ccfeb4a8eadc40c7e0fae357 refers to a dead (removed) revision in file `Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Views/HeightStructuresFailureMechanismResultView.resx'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Views/HeightStructuresFailureMechanismSectionResultRow.cs =================================================================== diff -u -r3280840f72a6c61740b803385f3af8ec1f6ede91 -r4d2271ee60b40225ccfeb4a8eadc40c7e0fae357 --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Views/HeightStructuresFailureMechanismSectionResultRow.cs (.../HeightStructuresFailureMechanismSectionResultRow.cs) (revision 3280840f72a6c61740b803385f3af8ec1f6ede91) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Views/HeightStructuresFailureMechanismSectionResultRow.cs (.../HeightStructuresFailureMechanismSectionResultRow.cs) (revision 4d2271ee60b40225ccfeb4a8eadc40c7e0fae357) @@ -31,6 +31,8 @@ /// internal class HeightStructuresFailureMechanismSectionResultRow { + private readonly HeightStructuresFailureMechanismSectionResult sectionResult; + /// /// Creates a new instance of . /// @@ -41,17 +43,17 @@ { throw new ArgumentNullException("sectionResult"); } - SectionResult = sectionResult; + this.sectionResult = sectionResult; } /// - /// Gets the name of the name. + /// Gets the name of the . /// public string Name { get { - return SectionResult.Section.Name; + return sectionResult.Section.Name; } } @@ -62,12 +64,12 @@ { get { - return SectionResult.AssessmentLayerOne; + return sectionResult.AssessmentLayerOne; } set { - SectionResult.AssessmentLayerOne = value; - SectionResult.NotifyObservers(); + sectionResult.AssessmentLayerOne = value; + sectionResult.NotifyObservers(); } } @@ -78,7 +80,7 @@ { get { - return SectionResult.AssessmentLayerTwoA; + return sectionResult.AssessmentLayerTwoA; } } @@ -89,11 +91,11 @@ { get { - return SectionResult.AssessmentLayerTwoB; + return sectionResult.AssessmentLayerTwoB; } set { - SectionResult.AssessmentLayerTwoB = value; + sectionResult.AssessmentLayerTwoB = value; } } @@ -104,14 +106,12 @@ { get { - return SectionResult.AssessmentLayerThree; + return sectionResult.AssessmentLayerThree; } set { - SectionResult.AssessmentLayerThree = value; + sectionResult.AssessmentLayerThree = value; } } - - private HeightStructuresFailureMechanismSectionResult SectionResult { get; set; } } } \ No newline at end of file Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.Test/HeightStructuresFailureMechanismSectionResultTest.cs =================================================================== diff -u -ra61d9a646a09ddee65775c179bba12c40003cf84 -r4d2271ee60b40225ccfeb4a8eadc40c7e0fae357 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.Test/HeightStructuresFailureMechanismSectionResultTest.cs (.../HeightStructuresFailureMechanismSectionResultTest.cs) (revision a61d9a646a09ddee65775c179bba12c40003cf84) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.Test/HeightStructuresFailureMechanismSectionResultTest.cs (.../HeightStructuresFailureMechanismSectionResultTest.cs) (revision 4d2271ee60b40225ccfeb4a8eadc40c7e0fae357) @@ -43,6 +43,9 @@ Assert.IsInstanceOf(sectionResult); Assert.AreSame(section, sectionResult.Section); Assert.IsFalse(sectionResult.AssessmentLayerOne); + Assert.AreEqual(0, sectionResult.AssessmentLayerTwoA.Value); + Assert.AreEqual(0, sectionResult.AssessmentLayerTwoB.Value); + Assert.AreEqual(0, sectionResult.AssessmentLayerThree.Value); } [Test] @@ -75,24 +78,6 @@ [Test] [TestCase(2.3)] [TestCase(24.6)] - public void AssessmentLayerTwoA_Always_ReturnsSetValue(double newValue) - { - // Setup - FailureMechanismSection section = CreateSection(); - var failureMechanismSectionResult = new HeightStructuresFailureMechanismSectionResult(section); - - RoundedDouble assessmentLayerTwoA = (RoundedDouble)newValue; - - // Call - failureMechanismSectionResult.AssessmentLayerTwoA = assessmentLayerTwoA; - - // Assert - Assert.AreEqual(assessmentLayerTwoA, failureMechanismSectionResult.AssessmentLayerTwoA); - } - - [Test] - [TestCase(2.3)] - [TestCase(24.6)] public void AssessmentLayerTwoB_Always_ReturnsSetValue(double newValue) { // Setup Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/Ringtoets.HeightStructures.Forms.Test.csproj =================================================================== diff -u -rf5ac9de8b45cef4515fa7a051c5af54446f96712 -r4d2271ee60b40225ccfeb4a8eadc40c7e0fae357 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/Ringtoets.HeightStructures.Forms.Test.csproj (.../Ringtoets.HeightStructures.Forms.Test.csproj) (revision f5ac9de8b45cef4515fa7a051c5af54446f96712) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/Ringtoets.HeightStructures.Forms.Test.csproj (.../Ringtoets.HeightStructures.Forms.Test.csproj) (revision 4d2271ee60b40225ccfeb4a8eadc40c7e0fae357) @@ -61,7 +61,7 @@ - + Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/FailureMechanismResultContextTreeNodeInfoTest.cs =================================================================== diff -u --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/FailureMechanismResultContextTreeNodeInfoTest.cs (revision 0) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/FailureMechanismResultContextTreeNodeInfoTest.cs (revision 4d2271ee60b40225ccfeb4a8eadc40c7e0fae357) @@ -0,0 +1,122 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.Linq; +using Core.Common.Controls.TreeView; +using Core.Common.Gui; +using Core.Common.Gui.ContextMenu; +using Core.Common.TestUtil; +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.Common.Forms.PresentationObjects; +using Ringtoets.HeightStructures.Data; +using Ringtoets.HeightStructures.Plugin; + +using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; +using RingtoetsCommonDataResources = Ringtoets.Common.Data.Properties.Resources; + +namespace Ringtoets.HeightStructures.Forms.Test.TreeNodeInfos +{ + [TestFixture] + public class FailureMechanismResultContextTreeNodeInfoTest + { + private MockRepository mocks; + private HeightStructuresGuiPlugin plugin; + private TreeNodeInfo info; + + [SetUp] + public void SetUp() + { + mocks = new MockRepository(); + plugin = new HeightStructuresGuiPlugin(); + info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(FailureMechanismSectionResultContext)); + } + + [Test] + public void Initialized_Always_ExpectedPropertiesSet() + { + // Assert + Assert.AreEqual(typeof(FailureMechanismSectionResultContext), info.TagType); + Assert.IsNotNull(info.Text); + Assert.IsNotNull(info.Image); + Assert.IsNotNull(info.ContextMenuStrip); + Assert.IsNull(info.ChildNodeObjects); + Assert.IsNull(info.ForeColor); + Assert.IsNull(info.EnsureVisibleOnCreate); + Assert.IsNull(info.CanRename); + Assert.IsNull(info.OnNodeRenamed); + Assert.IsNull(info.CanRemove); + Assert.IsNull(info.OnNodeRemoved); + Assert.IsNull(info.CanCheck); + Assert.IsNull(info.IsChecked); + Assert.IsNull(info.OnNodeChecked); + Assert.IsNull(info.CanDrag); + Assert.IsNull(info.CanDrop); + Assert.IsNull(info.CanInsert); + Assert.IsNull(info.OnDrop); + } + + [Test] + public void Text_Always_ReturnsFailureMechanismSectionResultDisplayName() + { + // Call + var text = info.Text(null); + + // Assert + Assert.AreEqual(RingtoetsCommonDataResources.FailureMechanism_AssessmentResult_DisplayName, text); + } + + [Test] + public void Image_Always_ReturnsFailureMechanismSectionResultIcon() + { + // Call + var image = info.Image(null); + + // Assert + TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.FailureMechanismSectionResultIcon, image); + } + + [Test] + public void ContextMenuStrip_Always_CallsContextMenuBuilderMethods() + { + // Setup + var guiMock = mocks.StrictMock(); + var treeViewControlMock = mocks.StrictMock(); + var failureMechanism = new HeightStructuresFailureMechanism(); + var nodeData = new FailureMechanismSectionResultContext(Enumerable.Empty(), failureMechanism); + var menuBuilderMock = mocks.StrictMock(); + + menuBuilderMock.Expect(mb => mb.AddOpenItem()).Return(menuBuilderMock); + menuBuilderMock.Expect(mb => mb.Build()).Return(null); + guiMock.Expect(cmp => cmp.Get(nodeData, treeViewControlMock)).Return(menuBuilderMock); + + mocks.ReplayAll(); + + plugin.Gui = guiMock; + + // Call + info.ContextMenuStrip(nodeData, null, treeViewControlMock); + + // Assert + mocks.VerifyAll(); // Expect no calls on arguments + } + } +} \ No newline at end of file Fisheye: Tag 4d2271ee60b40225ccfeb4a8eadc40c7e0fae357 refers to a dead (removed) revision in file `Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/FailureMechanismResultViewTreeNodeInfoTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/Views/HeightStructuresFailureMechanismResultViewTest.cs =================================================================== diff -u -r8f257d2094036e69e5da32dce96b5195f59508ea -r4d2271ee60b40225ccfeb4a8eadc40c7e0fae357 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/Views/HeightStructuresFailureMechanismResultViewTest.cs (.../HeightStructuresFailureMechanismResultViewTest.cs) (revision 8f257d2094036e69e5da32dce96b5195f59508ea) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/Views/HeightStructuresFailureMechanismResultViewTest.cs (.../HeightStructuresFailureMechanismResultViewTest.cs) (revision 4d2271ee60b40225ccfeb4a8eadc40c7e0fae357) @@ -30,6 +30,7 @@ using NUnit.Extensions.Forms; using NUnit.Framework; using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Forms.Views; using Ringtoets.HeightStructures.Data; using Ringtoets.HeightStructures.Forms.Views; @@ -59,8 +60,7 @@ using (var view = new HeightStructuresFailureMechanismResultView()) { // Assert - Assert.IsInstanceOf(view); - Assert.IsInstanceOf(view); + Assert.IsInstanceOf>(view); Assert.IsNull(view.Data); } } @@ -124,7 +124,7 @@ } [Test] - public void Data_SetOtherThanFailureMechanismSectionResultListData_DataNullAndDataGridViewOneEmtpyRow() + public void Data_SetOtherThanFailureMechanismSectionResultListData_DataNullAndDataGridViewEmtpy() { // Setup var testData = new object(); @@ -182,6 +182,7 @@ { var dataGridView = (DataGridView)new ControlTester("dataGridView").TheObject; + // Call dataGridView.Rows[0].Cells[assessmentLayerOneIndex].Value = checkBoxSelected; // Assert Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/ViewInfos/HeightStructuresFailureMechanismResultViewInfoTest.cs =================================================================== diff -u -rf1be6965092b5dc1b0e2e145d59e718493351fb8 -r4d2271ee60b40225ccfeb4a8eadc40c7e0fae357 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/ViewInfos/HeightStructuresFailureMechanismResultViewInfoTest.cs (.../HeightStructuresFailureMechanismResultViewInfoTest.cs) (revision f1be6965092b5dc1b0e2e145d59e718493351fb8) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/ViewInfos/HeightStructuresFailureMechanismResultViewInfoTest.cs (.../HeightStructuresFailureMechanismResultViewInfoTest.cs) (revision 4d2271ee60b40225ccfeb4a8eadc40c7e0fae357) @@ -60,17 +60,16 @@ public void Initialized_Always_ExpectedPropertiesSet() { // Assert + Assert.AreEqual(typeof(HeightStructuresFailureMechanismResultView), info.ViewType); Assert.AreEqual(typeof(FailureMechanismSectionResultContext), info.DataType); + Assert.AreEqual(typeof(IEnumerable), info.ViewDataType); } [Test] public void GetViewName_Always_ReturnsViewName() { - // Setup - var view = new HeightStructuresFailureMechanismResultView(); - // Call - var viewName = info.GetViewName(view, Enumerable.Empty()); + var viewName = info.GetViewName(null, null); // Assert Assert.AreEqual("Oordeel", viewName); @@ -95,36 +94,6 @@ } [Test] - public void ViewType_Always_ReturnsViewType() - { - // Call - var viewType = info.ViewType; - - // Assert - Assert.AreEqual(typeof(HeightStructuresFailureMechanismResultView), viewType); - } - - [Test] - public void DataType_Always_ReturnsDataType() - { - // Call - var dataType = info.DataType; - - // Assert - Assert.AreEqual(typeof(FailureMechanismSectionResultContext), dataType); - } - - [Test] - public void ViewDataType_Always_ReturnViewDataType() - { - // Call - var viewDataType = info.ViewDataType; - - // Assert - Assert.AreEqual(typeof(IEnumerable), viewDataType); - } - - [Test] public void Image_Always_ReturnsFailureMechanismSectionResultIcon() { // Call @@ -234,7 +203,7 @@ } [Test] - public void CloseForData_ViewNotCorrespondingToRemovedFailureMechanismContext_ReturnsFalse() + public void CloseForData_ViewNotCorrespondingToRemovedFailureMechanism_ReturnsFalse() { // Setup var failureMechanism = new HeightStructuresFailureMechanism(); @@ -276,7 +245,7 @@ } [Test] - public void CloseForData_ViewNotCorrespondingToRemovedFailureMechanism_ReturnsFalse() + public void CloseForData_ViewNotCorrespondingToRemovedFailureMechanismContext_ReturnsFalse() { // Setup var mocks = new MockRepository();