public void AddAssemblyGroupColumn_WithParameters_AddsColumnToDataGridViewControl()
        {
            // Setup
            using (var form = new Form())
                using (var control = new DataGridViewControl())
                {
                    form.Controls.Add(control);
                    form.Show();
                    var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject;

                    // Precondition
                    Assert.AreEqual(0, dataGridView.ColumnCount);

                    // Call
                    FailureMechanismSectionResultViewColumnBuilder.AddAssemblyGroupColumn(control, dataPropertyName);

                    // Assert
                    Assert.AreEqual(1, dataGridView.ColumnCount);

                    var columnData = (DataGridViewTextBoxColumn)dataGridView.Columns[0];
                    Assert.AreEqual(dataPropertyName, columnData.DataPropertyName);
                    Assert.AreEqual("Duidingsklasse", columnData.HeaderText);
                    Assert.IsFalse(columnData.ReadOnly);
                }
        }
        public void AddRefinedSectionProbabilityColumn_WithParameters_AddsColumnToDataGridViewControl()
        {
            // Setup
            using (var form = new Form())
                using (var control = new DataGridViewControl())
                {
                    form.Controls.Add(control);
                    form.Show();
                    var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject;

                    // Precondition
                    Assert.AreEqual(0, dataGridView.ColumnCount);

                    // Call
                    FailureMechanismSectionResultViewColumnBuilder.AddRefinedSectionProbabilityColumn(control, dataPropertyName);

                    // Assert
                    Assert.AreEqual(1, dataGridView.ColumnCount);

                    var columnData = (DataGridViewTextBoxColumn)dataGridView.Columns[0];
                    Assert.AreEqual(dataPropertyName, columnData.DataPropertyName);
                    Assert.AreEqual("Aangescherpte\r\nfaalkans per vak\r\n[1/jaar]", columnData.HeaderText);
                    Assert.IsFalse(columnData.ReadOnly);
                }
        }
        public void AddProbabilityRefinementTypeColumn_WithParameters_AddsColumnToDataGridViewControl()
        {
            // Setup
            using (var form = new Form())
                using (var control = new DataGridViewControl())
                {
                    form.Controls.Add(control);
                    form.Show();
                    var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject;

                    // Precondition
                    Assert.AreEqual(0, dataGridView.ColumnCount);

                    // Call
                    FailureMechanismSectionResultViewColumnBuilder.AddProbabilityRefinementTypeColumn(control, dataPropertyName);

                    // Assert
                    Assert.AreEqual(1, dataGridView.ColumnCount);

                    var columnData = (DataGridViewComboBoxColumn)dataGridView.Columns[0];
                    Assert.AreEqual(dataPropertyName, columnData.DataPropertyName);
                    Assert.AreEqual("Aanscherpen faalkans", columnData.HeaderText);
                    Assert.AreEqual("Value", columnData.ValueMember);
                    Assert.AreEqual("DisplayName", columnData.DisplayMember);

                    IEnumerable <EnumDisplayWrapper <ProbabilityRefinementType> > expectedDataSource = EnumDisplayWrapperHelper.GetEnumTypes <ProbabilityRefinementType>();
                    AssertEnumDisplayWrappersAreEqual(expectedDataSource, (EnumDisplayWrapper <ProbabilityRefinementType>[])columnData.DataSource);
                }
        }
        protected override void AddDataGridColumns()
        {
            FailureMechanismSectionResultViewColumnBuilder.AddSectionNameColumn(
                DataGridViewControl,
                nameof(NonAdoptableFailureMechanismSectionResultRow.Name));

            FailureMechanismSectionResultViewColumnBuilder.AddIsRelevantColumn(
                DataGridViewControl,
                nameof(NonAdoptableFailureMechanismSectionResultRow.IsRelevant));

            FailureMechanismSectionResultViewColumnBuilder.AddInitialFailureMechanismResultTypeColumn <NonAdoptableInitialFailureMechanismResultType>(
                DataGridViewControl,
                nameof(NonAdoptableFailureMechanismSectionResultRow.InitialFailureMechanismResultType));

            FailureMechanismSectionResultViewColumnBuilder.AddInitialFailureMechanismResultSectionProbabilityColumn(
                DataGridViewControl,
                nameof(NonAdoptableFailureMechanismSectionResultRow.InitialFailureMechanismResultSectionProbability));

            FailureMechanismSectionResultViewColumnBuilder.AddFurtherAnalysisTypeColumn(
                DataGridViewControl,
                nameof(NonAdoptableFailureMechanismSectionResultRow.FurtherAnalysisType));

            FailureMechanismSectionResultViewColumnBuilder.AddRefinedSectionProbabilityColumn(
                DataGridViewControl,
                nameof(NonAdoptableFailureMechanismSectionResultRow.RefinedSectionProbability));

            FailureMechanismSectionResultViewColumnBuilder.AddAssemblySectionProbabilityColumn(
                DataGridViewControl,
                nameof(NonAdoptableFailureMechanismSectionResultRow.SectionProbability));

            FailureMechanismSectionResultViewColumnBuilder.AddAssemblyGroupColumn(
                DataGridViewControl,
                nameof(NonAdoptableFailureMechanismSectionResultRow.AssemblyGroup));
        }
        public void AddIsRelevantColumn_DataGridViewControlNull_ThrowsArgumentNullException()
        {
            // Call
            void Call() => FailureMechanismSectionResultViewColumnBuilder.AddIsRelevantColumn(null, "property");

            // Assert
            var exception = Assert.Throws <ArgumentNullException>(Call);

            Assert.AreEqual("dataGridViewControl", exception.ParamName);
        }
        public void AddAssemblyGroupColumn_DataPropertyNameNull_ThrowsArgumentNullException()
        {
            // Call
            void Call() => FailureMechanismSectionResultViewColumnBuilder.AddAssemblyGroupColumn(new DataGridViewControl(), null);

            // Assert
            var exception = Assert.Throws <ArgumentNullException>(Call);

            Assert.AreEqual("dataPropertyName", exception.ParamName);
        }