public void DoPolimorphismWithInterfaces() { Impl obj = new Impl(); obj.A = "hola"; obj.B = "hola"; ClassValidator vtor = new ClassValidator(typeof(Impl)); InvalidValue[] values = vtor.GetInvalidValues(obj); Assert.AreEqual(2,values.Length); ClassValidator vtor2 = new ClassValidator(typeof(IContract)); InvalidValue[] values2 = vtor2.GetInvalidValues(obj); Assert.AreEqual(1, values2.Length, "Polimorphic support is no working"); ValidatorEngine ve = new ValidatorEngine(); values = ve.Validate(obj); Assert.AreEqual(2, values.Length); }
public void DoPolimorphismWithInterfaces() { Impl obj = new Impl(); obj.A = "hola"; obj.B = "hola"; ClassValidator vtor = new ClassValidator(typeof(Impl)); vtor.GetInvalidValues(obj).Should().Have.Count.EqualTo(2); ClassValidator vtor2 = new ClassValidator(typeof(IContract)); vtor2.GetInvalidValues(obj).Should("Polimorphic support is no working").Have.Count.EqualTo(1); ValidatorEngine ve = new ValidatorEngine(); ve.Validate(obj).Should().Have.Count.EqualTo(2); }