public void Should_Validate_Valid_Character(char input) { // Arrange var validator = new ThumbprintCharacterValidator(); // Act var result = validator.IsValid(input); // Assert result.ShouldNotBeNull(); result.Valid.ShouldBeTrue(); result.ErrorMessages.ShouldNotBeNull(); result.ErrorMessages.ShouldBeEmpty(); }
public void Should_Identify_Invalid_Character_In_Input(char input) { // Arrange var validator = new ThumbprintCharacterValidator(); // Act var result = validator.IsValid(input); // Assert result.ShouldNotBeNull(); result.Valid.ShouldBeFalse(); result.ErrorMessages.ShouldNotBeNull(); result.ErrorMessages.ShouldNotBeEmpty(); result.ErrorMessages.Count.ShouldEqual(1); result.ErrorMessages.Single().ParamName.ShouldEqual("input"); result.ErrorMessages.Single().Message.ShouldEqual(string.Format("The character '\\u{0:X4}' is not valid in this context.", (int)input)); }