public void Selection_ValidRowSelected_SameAsTableControlSelection()
        {
            // Setup
            using (var form = new Form())
                using (var control = new IllustrationPointsControl())
                {
                    form.Controls.Add(control);
                    form.Show();

                    control.Data = GetIllustrationPointControlItems().ToArray();

                    IllustrationPointsTableControl tableControl = ControlTestHelper.GetControls <IllustrationPointsTableControl>(form, "IllustrationPointsTableControl").Single();
                    DataGridViewControl            dataGridView = ControlTestHelper.GetDataGridViewControl(form, "illustrationPointsDataGridViewControl");

                    var initialControlSelection = control.Selection as IllustrationPointControlItem;

                    // Precondition
                    Assert.IsNotNull(initialControlSelection);

                    // Call
                    dataGridView.SetCurrentCell(dataGridView.Rows[1].Cells[0]);

                    // Assert
                    var expectedSelection = tableControl.Selection as IllustrationPointControlItem;
                    var controlSelection  = (IllustrationPointControlItem)control.Selection;
                    Assert.IsNotNull(expectedSelection);
                    Assert.AreSame(expectedSelection, controlSelection);

                    Assert.AreNotSame(initialControlSelection, controlSelection);
                }
        }
        public void Constructor_WithParentAndEmptyReferenceLineMeta_DefaultProperties()
        {
            // Setup
            using (var viewParent = new Form())
            {
                // Call
                using (var dialog = new ReferenceLineMetaSelectionDialog(viewParent, Enumerable.Empty <ReferenceLineMeta>()))
                {
                    // Assert
                    Assert.IsInstanceOf <DialogBase>(dialog);
                    Assert.IsNull(dialog.SelectedReferenceLineMeta);
                    Assert.AreEqual(@"Stel een traject samen", dialog.Text);

                    GroupBox groupBox = ControlTestHelper.GetControls <GroupBox>(dialog, "groupBox1").Single();
                    Assert.AreEqual("Kies de doelkans voor de semi-probabilistische toets (dijken):", groupBox.Text);

                    AssertReferenceLineMetaDataGridViewControl(dialog);
                }
            }
        }
        public void Data_ValueSet_DataSetToIllustrationPointsChartControl()
        {
            // Setup
            using (var form = new Form())
                using (var control = new IllustrationPointsControl())
                {
                    form.Controls.Add(control);
                    form.Show();

                    IllustrationPointsChartControl chartControl = ControlTestHelper.GetControls <IllustrationPointsChartControl>(form, "IllustrationPointsChartControl").Single();
                    IllustrationPointsTableControl tableControl = ControlTestHelper.GetControls <IllustrationPointsTableControl>(form, "IllustrationPointsTableControl").Single();

                    IEnumerable <IllustrationPointControlItem> data = Enumerable.Empty <IllustrationPointControlItem>();

                    // Call
                    control.Data = data;

                    // Assert
                    Assert.AreSame(data, control.Data);
                    Assert.AreSame(data, chartControl.Data);
                    Assert.AreSame(data, tableControl.Data);
                }
        }
        public void Constructor_ExpectedValues()
        {
            // Setup
            var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike);

            // Call
            using (var view = new FailureMechanismSectionAssemblyGroupsView(assessmentSection))
            {
                // Assert
                Assert.IsInstanceOf <UserControl>(view);
                Assert.IsInstanceOf <IView>(view);
                Assert.IsNull(view.Data);
                Assert.AreSame(assessmentSection, view.AssessmentSection);

                Assert.AreEqual(1, view.Controls.Count);

                Panel groupBoxPanel = ControlTestHelper.GetControls <Panel>(view, "groupBoxPanel").Single();
                Assert.AreEqual(1, groupBoxPanel.Controls.Count);
                Assert.AreEqual(DockStyle.Fill, groupBoxPanel.Dock);

                AssemblyGroupsTable <FailureMechanismSectionAssemblyGroup> assemblyGroupsTable = GetAssemblyGroupsTable(view);
                Assert.AreEqual(DockStyle.Fill, assemblyGroupsTable.Dock);
            }
        }
 private static IChartControl GetChartControl(MacroStabilityInwardsOutputChartControl view)
 {
     return(ControlTestHelper.GetControls <IChartControl>(view, "chartControl").Single());
 }
 private static DataGridView GetSectionsDataGridView(FailureMechanismSectionsView view)
 {
     return(ControlTestHelper.GetControls <DataGridView>(view, "dataGridView").Single());
 }
 private static AssemblyGroupsTable <FailureMechanismSectionAssemblyGroup> GetAssemblyGroupsTable(
     FailureMechanismSectionAssemblyGroupsView view)
 {
     return(ControlTestHelper.GetControls <AssemblyGroupsTable <FailureMechanismSectionAssemblyGroup> >(
                view, "assemblyGroupsTable").Single());
 }
Exemplo n.º 8
0
 private static DataGridViewControl GetSectionsDataGridViewControl(FailureMechanismSectionsProbabilityAssessmentView view)
 {
     return(ControlTestHelper.GetControls <DataGridViewControl>(view, "failureMechanismSectionsDataGridViewControl").Single());
 }
Exemplo n.º 9
0
 private IllustrationPointsControl GetIllustrationPointsControl()
 {
     return(ControlTestHelper.GetControls <IllustrationPointsControl>(testForm, "IllustrationPointsControl").Single());
 }
 private static AssemblyGroupsTable <AssessmentSectionAssemblyGroup> GetCategoriesTable(AssessmentSectionAssemblyGroupsView view)
 {
     return(ControlTestHelper.GetControls <AssemblyGroupsTable <AssessmentSectionAssemblyGroup> >(
                view, "assemblyGroupsTable").Single());
 }
Exemplo n.º 11
0
 private static MacroStabilityInwardsSlicesTable GetSlicesTable(MacroStabilityInwardsOutputView view)
 {
     return(ControlTestHelper.GetControls <MacroStabilityInwardsSlicesTable>(view, "slicesTable").Single());
 }
Exemplo n.º 12
0
 private static MacroStabilityInwardsOutputChartControl GetChartControl(Form form)
 {
     return(ControlTestHelper.GetControls <MacroStabilityInwardsOutputChartControl>(form, "macroStabilityInwardsOutputChartControl").Single());
 }