public override bool Equals(object obj) { LunComboBoxItem cf = obj as LunComboBoxItem; if (cf == null) { return(false); } return(Vdi.Equals(cf.Vdi)); }
public void ItemMatchingWithMatchingValues() { Mock<VDI> vdi = GetMockVdi(0); LunComboBoxItem item = new LunComboBoxItem(vdi.Object){AdditionalConstraints = new List<Predicate<VDI>>()}; LunComboBoxItem secondItem = new LunComboBoxItem(vdi.Object) { AdditionalConstraints = new List<Predicate<VDI>>() }; item.EnableItemMatching(secondItem); Assert.That(item.Enabled, Is.True); item.DisableItemMatching(secondItem); Assert.That(item.Enabled, Is.False); item.EnableItemMatching(secondItem); Assert.That(item.Enabled, Is.True); }
private void SetMatchingItemEnabledState(LunComboBoxItem itemToMatch, bool enabledState) { if (itemToMatch == null) { return; } if (Vdi == itemToMatch.Vdi) { enabled = enabledState; } }
/// <summary> /// Deal with the changes made to the dropdown cell by firing an event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dataGridViewCell_CurrentCellDirtyStateChanged(object sender, EventArgs e) { dataGridView.CommitEdit(DataGridViewDataErrorContexts.Commit); foreach (LunPerVdiPickerItem row in dataGridView.SelectedRows) { LunComboBoxItem item = row.Cells[LunColumn.Index].Value as LunComboBoxItem; DisableOtherEquivalentValues(item, row.Index); } if (OnSelectionChanged != null) { OnSelectionChanged(this, new EventArgs()); } }
private void EnableAllEquivalentValues(LunComboBoxItem item) { foreach (LunPerVdiPickerItem row in dataGridView.Rows) { DataGridViewEnableableComboBoxCell cb = row.Cells[LunColumn.Index] as DataGridViewEnableableComboBoxCell; if (cb == null) { return; } foreach (LunComboBoxItem i in cb.Items) { i.EnableItemMatching(item); } } dataGridView.Refresh(); }
private void DisableOtherEquivalentValues(LunComboBoxItem item, int excludingRowIndex) { foreach (LunPerVdiPickerItem row in dataGridView.Rows) { DataGridViewEnableableComboBoxCell cb = row.Cells[LunColumn.Index] as DataGridViewEnableableComboBoxCell; if (cb == null) { return; } if (row.Index != excludingRowIndex) { foreach (LunComboBoxItem i in cb.Items) { i.DisableItemMatching(item); } } } dataGridView.Refresh(); }
public void DisableItemMatching(LunComboBoxItem itemToDisable) { SetMatchingItemEnabledState(itemToDisable, false); }
private void EnableAllEquivalentValues(LunComboBoxItem item) { foreach (LunPerVdiPickerItem row in dataGridView.Rows) { DataGridViewEnableableComboBoxCell cb = row.Cells[LunColumn.Index] as DataGridViewEnableableComboBoxCell; if (cb == null) return; foreach (LunComboBoxItem i in cb.Items) { i.EnableItemMatching(item); } } dataGridView.Refresh(); }
private void DisableOtherEquivalentValues(LunComboBoxItem item, int excludingRowIndex) { foreach (LunPerVdiPickerItem row in dataGridView.Rows) { DataGridViewEnableableComboBoxCell cb = row.Cells[LunColumn.Index] as DataGridViewEnableableComboBoxCell; if (cb == null) return; if (row.Index != excludingRowIndex) { foreach (LunComboBoxItem i in cb.Items) { i.DisableItemMatching(item); } } } dataGridView.Refresh(); }
public void EnableItemMatching(LunComboBoxItem itemToEnable) { SetMatchingItemEnabledState(itemToEnable, true); }
public bool VBDCountDisablesItem(int vbdCount) { Mock<VDI> vdi = GetMockVdi(vbdCount); LunComboBoxItem item = new LunComboBoxItem(vdi.Object); return item.Enabled; }
public void NullAdditionalConstraintsThrows() { Mock<VDI> vdi = GetMockVdi(0); LunComboBoxItem item = new LunComboBoxItem(vdi.Object) { AdditionalConstraints = null }; bool b = item.Enabled; }
public void AdditionalConstraintsDisableItem(List<Predicate<VDI>> constraints, bool expectedEnabled, string description ) { Mock<VDI> vdi = GetMockVdi(0); LunComboBoxItem item = new LunComboBoxItem(vdi.Object) {AdditionalConstraints = constraints}; Assert.That(item.Enabled, Is.EqualTo(expectedEnabled), description); }
private void SetMatchingItemEnabledState(LunComboBoxItem itemToMatch, bool enabledState) { if (itemToMatch == null) return; if (Vdi == itemToMatch.Vdi) enabled = enabledState; }
public void ItemToStringIncludeSizeDetails(string sizeText, string nameLabel, string expectedResult) { Mock<VDI> vdi = GetMockVdi(0); vdi.Setup(v => v.SizeText).Returns(sizeText); vdi.Setup(v => v.name_label).Returns(nameLabel); LunComboBoxItem item = new LunComboBoxItem(vdi.Object); Assert.That(item.ToString(), Is.EqualTo(expectedResult)); }