public void NonRequiredPropertyWithValidSetItemReturnsTrueOnNullProperty() { // Arrange var sut = new ClassWithNonRequiredValidateSetAttributePropertiesAsArray(); // Act var result = sut.IsValid(); // Assert Assert.IsTrue(result); }
public void NonRequiredPropertyWithValidSetItemReturnsTrue() { // Arrange var sut = new ClassWithNonRequiredValidateSetAttributePropertiesAsArray { StringPropertyWithValidateSet = "valid-set-item" }; // Act var result = sut.IsValid(); // Assert Assert.IsTrue(result); }
public void ValidateSetReturnsRequiredSetWithErrorMessage() { // Arrange var sut = new ClassWithNonRequiredValidateSetAttributePropertiesAsArray { StringPropertyWithValidateSet = "invalid-set-item" }; var isValid = sut.IsValid(); Assert.IsFalse(isValid); // Act var results = sut.GetValidationResults(); // Assert Assert.AreEqual(1, results.Count); var errorMessage = results[0].ErrorMessage; Assert.IsTrue(!string.IsNullOrWhiteSpace(errorMessage)); Assert.IsTrue(errorMessage.Contains("item1|item2|item3|valid-set-item"), errorMessage); }