private void LastOctetTextBoxTextChanged(object sender, EventArgs e) { if (LastOctetValidator.Validate(baseIpTextBox.Text, lastOctetTextBox.Text)) { lastOctetTextBox.BackColor = DefaultBackColor; _viewModel.LastOctetMax = uint.Parse(lastOctetTextBox.Text, CultureInfo.CurrentCulture); } else { lastOctetTextBox.BackColor = Color.Red; } }
public RangeManagementControl(RangeManagementViewModel viewModel) { _addressValidationRule = new AddressValidationRule(); _lastOctetValidator = new LastOctetValidator(); _viewModel = viewModel; InitializeComponent(); baseIpTextBox.Text = _viewModel.BaseIp; if (_viewModel.LastOctetMax > 0) { lastOctetTextBox.Text = _viewModel.LastOctetMax.ToString(); } }
public void InvalidLastOctetZero() { Assert.IsFalse(LastOctetValidator.Validate("192.168.1.10", "0")); }
public void Before() { _validator = new LastOctetValidator(); }
public void InvalidBothInputsEmpty() { Assert.IsFalse(LastOctetValidator.Validate(string.Empty, string.Empty)); }
public void InvalidBothInputsNull() { Assert.IsFalse(LastOctetValidator.Validate(null, null)); }
public void ValidLastOctetValid() { Assert.IsTrue(LastOctetValidator.Validate("192.168.1.10", "20")); }
public void InvalidLastLessThanLastOfBaseIp() { Assert.IsFalse(LastOctetValidator.Validate("192.168.1.10", "8")); }
public void InvalidLastOctetOverMax() { Assert.IsFalse(LastOctetValidator.Validate("192.168.1.10", "255")); }