public void LessThanOrEqualMax_ReturnsTrue(int value) { // Arrange var maxValueAttribute = new MaxValueAttribute(5); // Act var isValid = maxValueAttribute.IsValid(value); // Assert Assert.True(isValid); }
public void GreaterThanMax_ReturnsFalse() { // Arrange var maxValueAttribute = new MaxValueAttribute(5); var value = 6; // Act var isValid = maxValueAttribute.IsValid(value); // Assert Assert.False(isValid); }
public void MaxValueAttribute_IsValid_ValueIsHigherThanMax_ShouldReturnFalse() { // arrange int maxValue = 5; int value = 6; var attribute = new MaxValueAttribute(maxValue); // act bool valid = attribute.IsValid(value); // assert Assert.IsFalse(valid); }
public void MaxValueAttribute_IsValid_ValueIsSmallerThanMax_ShouldReturnTrue() { // arrange int maxValue = 5; int value = 4; var attribute = new MaxValueAttribute(maxValue); // act bool valid = attribute.IsValid(value); // assert Assert.IsTrue(valid); }
public void IsValid_Null() { Assert.True(attribute.IsValid(null)); }
public void IsValid_NullValueIsValid() { Assert.IsTrue(attribute.IsValid(null)); }