public void MissingKey() { Building b = new Building(); b.Address = "2323 Younge St"; ClassValidator validator = new ClassValidator(typeof (Building)); validator.GetInvalidValues(b); // message should be interpolated lazily in DefaultMessageInterpolator b = new Building(); b.Address = string.Empty; var invalidValues = validator.GetInvalidValues(b); invalidValues.Should().Not.Be.Empty(); invalidValues.Select(iv => iv.Message).Should("Missing key should be left unchanged").Contain( "{notpresent.Key} and {key.notPresent} and {key.notPresent2} 1"); }
public void MissingKey() { Building b = new Building(); b.Address = "2323 Younge St"; ClassValidator validator = new ClassValidator(typeof (Building)); validator.GetInvalidValues(b); // message should be interpolated lazily in DefaultMessageInterpolator b = new Building(); b.Address = string.Empty; InvalidValue[] invalidValues = validator.GetInvalidValues(b); Assert.Greater(invalidValues.Length, 0); Assert.AreEqual("{notpresent.Key} and #{key.notPresent} and {key.notPresent2} 1", invalidValues[0].Message, "Missing key should be left unchanged"); }