public void Show_Always_InitializesTooltip() { // Setup using (var dialogParent = new Form()) using (var dialog = new AssessmentSectionMergeDataProviderDialog(dialogParent)) { // Call dialog.Show(); // Assert var infoIcon = (PictureBox) new ControlTester("infoIcon", dialog).TheObject; TestHelper.AssertImagesAreEqual(CoreGuiResources.information, infoIcon.BackgroundImage); Assert.AreEqual(ImageLayout.Center, infoIcon.BackgroundImageLayout); var toolTip = TypeUtils.GetField <ToolTip>(dialog, "toolTip"); Assert.AreEqual("Hydraulische belastingen op trajectniveau worden altijd samengevoegd.\r\n" + "Daarbij gaan de huidige berekeningsresultaten voor belastingen op trajectniveau niet verloren.", toolTip.GetToolTip(infoIcon)); Assert.AreEqual(5000, toolTip.AutoPopDelay); Assert.AreEqual(100, toolTip.InitialDelay); Assert.AreEqual(100, toolTip.ReshowDelay); } }
public void Show_Always_DefaultProperties() { // Setup using (var dialogParent = new Form()) using (var dialog = new AssessmentSectionMergeDataProviderDialog(dialogParent)) { // Call dialog.Show(); // Assert Assert.AreEqual(1, dialog.Controls.Count); var tableLayoutPanel = (TableLayoutPanel) new ControlTester("tableLayoutPanelForForm").TheObject; Assert.AreEqual(1, tableLayoutPanel.ColumnCount); Assert.AreEqual(4, tableLayoutPanel.RowCount); var panelForLabels = (Panel)tableLayoutPanel.GetControlFromPosition(0, 1); var failureMechanismSelectionLabel = (Label)panelForLabels.Controls[0]; Assert.AreEqual("Selecteer faalmechanismen:", failureMechanismSelectionLabel.Text); Assert.IsInstanceOf <DataGridViewControl>(tableLayoutPanel.GetControlFromPosition(0, 2)); var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject; Assert.AreEqual(columnCount, dataGridView.ColumnCount); Assert.AreEqual(0, dataGridView.RowCount); Assert.IsInstanceOf <DataGridViewCheckBoxColumn>(dataGridView.Columns[isSelectedIndex]); Assert.IsInstanceOf <DataGridViewTextBoxColumn>(dataGridView.Columns[failureMechanismNameIndex]); Assert.IsInstanceOf <DataGridViewCheckBoxColumn>(dataGridView.Columns[inAssemblyIndex]); Assert.IsInstanceOf <DataGridViewCheckBoxColumn>(dataGridView.Columns[hasSectionsIndex]); Assert.IsInstanceOf <DataGridViewTextBoxColumn>(dataGridView.Columns[numberOfCalculationsIndex]); Assert.AreEqual("Selecteer", dataGridView.Columns[isSelectedIndex].HeaderText); Assert.AreEqual("Faalmechanisme", dataGridView.Columns[failureMechanismNameIndex].HeaderText); Assert.AreEqual("In assemblage", dataGridView.Columns[inAssemblyIndex].HeaderText); Assert.AreEqual("Heeft vakindeling", dataGridView.Columns[hasSectionsIndex].HeaderText); Assert.AreEqual("Aantal berekeningen", dataGridView.Columns[numberOfCalculationsIndex].HeaderText); Assert.IsFalse(dataGridView.Columns[isSelectedIndex].ReadOnly); Assert.IsTrue(dataGridView.Columns[failureMechanismNameIndex].ReadOnly); Assert.IsTrue(dataGridView.Columns[inAssemblyIndex].ReadOnly); Assert.IsTrue(dataGridView.Columns[hasSectionsIndex].ReadOnly); Assert.IsTrue(dataGridView.Columns[numberOfCalculationsIndex].ReadOnly); Assert.AreEqual(DataGridViewAutoSizeColumnsMode.AllCells, dataGridView.AutoSizeColumnsMode); Assert.AreEqual(DataGridViewContentAlignment.MiddleCenter, dataGridView.ColumnHeadersDefaultCellStyle.Alignment); var flowLayoutPanel = (FlowLayoutPanel)tableLayoutPanel.GetControlFromPosition(0, 3); Control.ControlCollection flowLayoutPanelControls = flowLayoutPanel.Controls; Assert.AreEqual(3, flowLayoutPanelControls.Count); Control pictureBox = flowLayoutPanel.Controls[2]; Assert.IsInstanceOf <PictureBox>(pictureBox); var buttonSelect = (Button) new ButtonTester("importButton", dialog).TheObject; Assert.AreEqual("Importeren", buttonSelect.Text); Assert.IsTrue(buttonSelect.Enabled); Assert.AreEqual(DialogResult.OK, buttonSelect.DialogResult); var buttonCancel = (Button) new ButtonTester("cancelButton", dialog).TheObject; Assert.AreEqual("Annuleren", buttonCancel.Text); Assert.AreEqual(dialog.CancelButton, buttonCancel); Assert.AreEqual(DialogResult.Cancel, buttonCancel.DialogResult); Assert.AreEqual(720, dialog.MinimumSize.Width); Assert.AreEqual(590, dialog.MinimumSize.Height); } }