public void IPIsInSubnetByPrefix() { Controller controller = new Controller(); controller.Name = null; controller.IP = "192.168.1.1"; IClassValidator validator = GetClassValidator(typeof(Controller)); validator.GetInvalidValues(controller).Should().Have.Count.EqualTo(2); controller.IP = "192.168.2.1"; validator.GetInvalidValues(controller).Should().Have.Count.EqualTo(1); controller.Name = "Controller"; validator.GetInvalidValues(controller).Should().Be.Empty(); }
public void IPIsInSubnetByPrefix() { Controller controller = new Controller(); controller.Name = null; controller.IP = "192.168.1.1"; IClassValidator validator = GetClassValidator(typeof(Controller)); InvalidValue[] res = validator.GetInvalidValues(controller); Assert.AreEqual(2, res.Length); controller.IP = "192.168.2.1"; res = validator.GetInvalidValues(controller); Assert.AreEqual(1, res.Length); controller.Name = "Controller"; res = validator.GetInvalidValues(controller); Assert.AreEqual(0, res.Length); }