Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj =================================================================== diff -u -rdaad58f9bc7ccf190cf56cf54b3b00fba443c267 -r57517bf1c8e4d95cdd1d1e871891995c16cf94ea --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj (.../Ringtoets.Integration.Forms.csproj) (revision daad58f9bc7ccf190cf56cf54b3b00fba443c267) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj (.../Ringtoets.Integration.Forms.csproj) (revision 57517bf1c8e4d95cdd1d1e871891995c16cf94ea) @@ -63,11 +63,11 @@ ReferenceLineMetaSelectionDialog.cs - + UserControl - - AssessmentSectionCombinedAssemblyResultView.cs + + AssemblyResultTotalView.cs UserControl @@ -249,8 +249,8 @@ ReferenceLineMetaSelectionDialog.cs Designer - - AssessmentSectionCombinedAssemblyResultView.cs + + AssemblyResultTotalView.cs AssessmentSectionView.cs Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssemblyResultTotalView.Designer.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssemblyResultTotalView.Designer.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssemblyResultTotalView.Designer.cs (revision 57517bf1c8e4d95cdd1d1e871891995c16cf94ea) @@ -0,0 +1,80 @@ +// Copyright (C) Stichting Deltares 2017. 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. + +namespace Ringtoets.Integration.Forms.Views +{ + partial class AssemblyResultTotalView + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.dataGridViewControl = new Core.Common.Controls.DataGrid.DataGridViewControl(); + this.SuspendLayout(); + // + // dataGridViewControl + // + this.dataGridViewControl.Dock = System.Windows.Forms.DockStyle.Fill; + this.dataGridViewControl.Location = new System.Drawing.Point(0, 0); + this.dataGridViewControl.MultiSelect = false; + this.dataGridViewControl.Name = "dataGridViewControl"; + this.dataGridViewControl.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.RowHeaderSelect; + this.dataGridViewControl.Size = new System.Drawing.Size(177, 202); + this.dataGridViewControl.TabIndex = 0; + // + // AssessmentSectionCombinedAssemblyResultView + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.dataGridViewControl); + this.Name = "AssemblyResultTotalView"; + this.Size = new System.Drawing.Size(177, 202); + this.ResumeLayout(false); + + } + + #endregion + + private Core.Common.Controls.DataGrid.DataGridViewControl dataGridViewControl; + } +} Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssemblyResultTotalView.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssemblyResultTotalView.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssemblyResultTotalView.cs (revision 57517bf1c8e4d95cdd1d1e871891995c16cf94ea) @@ -0,0 +1,72 @@ +// Copyright (C) Stichting Deltares 2017. 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; +using System.Collections.Generic; +using System.Linq; +using System.Windows.Forms; +using Core.Common.Controls.Views; +using Ringtoets.Integration.Data; + +namespace Ringtoets.Integration.Forms.Views +{ + /// + /// The view for the combined assembly result for all failure mechanisms of + /// the . + /// + public partial class AssemblyResultTotalView : UserControl, IView + { + private readonly AssessmentSection assessmentSection; + + /// + /// Creates a new instance of . + /// + /// The to create the view for. + /// Thrown when + /// is null. + public AssemblyResultTotalView(AssessmentSection assessmentSection) + { + if (assessmentSection == null) + { + throw new ArgumentNullException(nameof(assessmentSection)); + } + + this.assessmentSection = assessmentSection; + + InitializeComponent(); + InitializeDataGridView(); + } + + public object Data { get; set; } + + private void InitializeDataGridView() + { + dataGridViewControl.AddTextBoxColumn(nameof(FailureMechanismAssemblyResultRow.Name), "Toetsspoor", true); + dataGridViewControl.AddTextBoxColumn(nameof(FailureMechanismAssemblyResultRow.Code), "Label", true); + dataGridViewControl.AddTextBoxColumn(nameof(FailureMechanismAssemblyResultRow.Group), "Groep", true); + + IEnumerable rows = assessmentSection.GetFailureMechanisms() + .Select(fm => new FailureMechanismAssemblyResultRow(fm)) + .ToList(); + dataGridViewControl.SetDataSource(rows); + } + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssemblyResultTotalView.resx =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssemblyResultTotalView.resx (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssemblyResultTotalView.resx (revision 57517bf1c8e4d95cdd1d1e871891995c16cf94ea) @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file Fisheye: Tag 57517bf1c8e4d95cdd1d1e871891995c16cf94ea refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionCombinedAssemblyResultView.Designer.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 57517bf1c8e4d95cdd1d1e871891995c16cf94ea refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionCombinedAssemblyResultView.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 57517bf1c8e4d95cdd1d1e871891995c16cf94ea refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionCombinedAssemblyResultView.resx'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj =================================================================== diff -u -rdaad58f9bc7ccf190cf56cf54b3b00fba443c267 -r57517bf1c8e4d95cdd1d1e871891995c16cf94ea --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision daad58f9bc7ccf190cf56cf54b3b00fba443c267) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision 57517bf1c8e4d95cdd1d1e871891995c16cf94ea) @@ -66,7 +66,7 @@ - + Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssemblyResultTotalViewTest.cs =================================================================== diff -u --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssemblyResultTotalViewTest.cs (revision 0) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssemblyResultTotalViewTest.cs (revision 57517bf1c8e4d95cdd1d1e871891995c16cf94ea) @@ -0,0 +1,138 @@ +// Copyright (C) Stichting Deltares 2017. 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; +using System.Linq; +using System.Windows.Forms; +using Core.Common.Controls.Views; +using Core.Common.TestUtil; +using NUnit.Extensions.Forms; +using NUnit.Framework; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Integration.Data; +using Ringtoets.Integration.Forms.Views; + +namespace Ringtoets.Integration.Forms.Test.Views +{ + [TestFixture] + public class AssemblyResultTotalViewTest + { + private const int expectedColumnCount = 3; + private const int failureMechanismNameColumnIndex = 0; + private const int failureMechanismCodeColumnIndex = 1; + private const int failureMechanismGroupColumnIndex = 2; + + private Form testForm; + + [SetUp] + public void Setup() + { + testForm = new Form(); + } + + [TearDown] + public void TearDown() + { + testForm.Dispose(); + } + + [Test] + public void Constructor_AssessmentSectionNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => new AssemblyResultTotalView(null); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("assessmentSection", exception.ParamName); + } + + [Test] + public void DefaultConstructor_DefaultValues() + { + // Setup + var random = new Random(21); + var assessmentSection = new AssessmentSection(random.NextEnumValue()); + + // Call + using (var view = new AssemblyResultTotalView(assessmentSection)) + { + testForm.Controls.Add(view); + testForm.Show(); + + // Assert + Assert.AreEqual(1, view.Controls.Count); + + Assert.IsInstanceOf(view); + Assert.IsInstanceOf(view); + Assert.IsNull(view.Data); + } + } + + [Test] + public void GivenFormWithAssessmentSection_ThenExpectedColumnsAreVisible() + { + // Given + var random = new Random(21); + var assessmentSection = new AssessmentSection(random.NextEnumValue()); + + // Then + using (var view = new AssemblyResultTotalView(assessmentSection)) + { + testForm.Controls.Add(view); + testForm.Show(); + + var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject; + Assert.AreEqual(expectedColumnCount, dataGridView.ColumnCount); + + DataGridViewColumnCollection dataGridViewColumns = dataGridView.Columns; + + Assert.IsInstanceOf(dataGridViewColumns[failureMechanismNameColumnIndex]); + Assert.IsInstanceOf(dataGridViewColumns[failureMechanismCodeColumnIndex]); + Assert.IsInstanceOf(dataGridViewColumns[failureMechanismGroupColumnIndex]); + + Assert.AreEqual("Toetsspoor", dataGridViewColumns[failureMechanismNameColumnIndex].HeaderText); + Assert.AreEqual("Label", dataGridViewColumns[failureMechanismCodeColumnIndex].HeaderText); + Assert.AreEqual("Groep", dataGridViewColumns[failureMechanismGroupColumnIndex].HeaderText); + + Assert.IsTrue(dataGridViewColumns[failureMechanismNameColumnIndex].ReadOnly); + Assert.IsTrue(dataGridViewColumns[failureMechanismCodeColumnIndex].ReadOnly); + Assert.IsTrue(dataGridViewColumns[failureMechanismGroupColumnIndex].ReadOnly); + + DataGridViewRowCollection rows = dataGridView.Rows; + IFailureMechanism[] failureMechanisms = assessmentSection.GetFailureMechanisms().ToArray(); + Assert.AreEqual(failureMechanisms.Length, rows.Count); + + for (var i = 0; i < failureMechanisms.Length; i++) + { + IFailureMechanism failureMechanism = failureMechanisms[i]; + DataGridViewCellCollection cells = rows[i].Cells; + Assert.AreEqual(expectedColumnCount, cells.Count); + + Assert.AreEqual(failureMechanism.Name, cells[failureMechanismNameColumnIndex].Value); + Assert.AreEqual(failureMechanism.Code, cells[failureMechanismCodeColumnIndex].Value); + Assert.AreEqual(failureMechanism.Group, cells[failureMechanismGroupColumnIndex].Value); + } + } + } + } +} \ No newline at end of file Fisheye: Tag 57517bf1c8e4d95cdd1d1e871891995c16cf94ea refers to a dead (removed) revision in file `Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssessmentSectionCombinedAssemblyResultViewTest.cs'. Fisheye: No comparison available. Pass `N' to diff?