예제 #1
0
 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;
     }
 }
예제 #2
0
        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();
            }
        }
예제 #3
0
 public void InvalidLastOctetZero()
 {
     Assert.IsFalse(LastOctetValidator.Validate("192.168.1.10", "0"));
 }
 public void Before()
 {
     _validator = new LastOctetValidator();
 }
예제 #5
0
 public void InvalidBothInputsEmpty()
 {
     Assert.IsFalse(LastOctetValidator.Validate(string.Empty, string.Empty));
 }
예제 #6
0
 public void InvalidBothInputsNull()
 {
     Assert.IsFalse(LastOctetValidator.Validate(null, null));
 }
예제 #7
0
 public void ValidLastOctetValid()
 {
     Assert.IsTrue(LastOctetValidator.Validate("192.168.1.10", "20"));
 }
예제 #8
0
 public void InvalidLastLessThanLastOfBaseIp()
 {
     Assert.IsFalse(LastOctetValidator.Validate("192.168.1.10", "8"));
 }
예제 #9
0
 public void InvalidLastOctetOverMax()
 {
     Assert.IsFalse(LastOctetValidator.Validate("192.168.1.10", "255"));
 }