public void AddRefinedProfileProbabilityColumn_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.AddRefinedProfileProbabilityColumn(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 doorsnede\r\n[1/jaar]", columnData.HeaderText);
                    Assert.IsFalse(columnData.ReadOnly);
                }
        }
        public void AddRefinedProfileProbabilityColumn_DataPropertyNameNull_ThrowsArgumentNullException()
        {
            // Call
            void Call() => FailureMechanismSectionResultViewColumnBuilder.AddRefinedProfileProbabilityColumn(new DataGridViewControl(), null);

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

            Assert.AreEqual("dataPropertyName", exception.ParamName);
        }
Exemplo n.º 3
0
        protected override void AddDataGridColumns()
        {
            FailureMechanismSectionResultViewColumnBuilder.AddSectionNameColumn(
                DataGridViewControl,
                nameof(AdoptableWithProfileProbabilityFailureMechanismSectionResultRow.Name));

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

            FailureMechanismSectionResultViewColumnBuilder.AddInitialFailureMechanismResultTypeColumn <AdoptableInitialFailureMechanismResultType>(
                DataGridViewControl,
                nameof(AdoptableWithProfileProbabilityFailureMechanismSectionResultRow.InitialFailureMechanismResultType));

            FailureMechanismSectionResultViewColumnBuilder.AddInitialFailureMechanismResultProfileProbabilityColumn(
                DataGridViewControl,
                nameof(AdoptableWithProfileProbabilityFailureMechanismSectionResultRow.InitialFailureMechanismResultProfileProbability));

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

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

            FailureMechanismSectionResultViewColumnBuilder.AddProbabilityRefinementTypeColumn(
                DataGridViewControl,
                nameof(AdoptableWithProfileProbabilityFailureMechanismSectionResultRow.ProbabilityRefinementType));

            FailureMechanismSectionResultViewColumnBuilder.AddRefinedProfileProbabilityColumn(
                DataGridViewControl,
                nameof(AdoptableWithProfileProbabilityFailureMechanismSectionResultRow.RefinedProfileProbability));

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

            FailureMechanismSectionResultViewColumnBuilder.AddAssemblyProfileProbabilityColumn(
                DataGridViewControl,
                nameof(AdoptableWithProfileProbabilityFailureMechanismSectionResultRow.ProfileProbability));

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

            FailureMechanismSectionResultViewColumnBuilder.AddAssemblySectionNColumn(
                DataGridViewControl,
                nameof(AdoptableWithProfileProbabilityFailureMechanismSectionResultRow.SectionN));

            FailureMechanismSectionResultViewColumnBuilder.AddAssemblyGroupColumn(
                DataGridViewControl,
                nameof(AdoptableWithProfileProbabilityFailureMechanismSectionResultRow.AssemblyGroup));
        }