public void UnrecognizedNumberCreatesValidationError() { //arrange var emptyInput = "photo-album 0ne"; var systemUnderTest = new PhotoAlbumInputValidator(); //act var result = systemUnderTest.ValidateInput(emptyInput); //assert Assert.AreEqual(1, result.ValidationResults.Count); Assert.IsTrue(result.ValidationResults.Select(r => r.ErrorMessage).Contains("Unable to get page number from command")); }
public void EmptyStringReturnsValidationError() { //arrange var emptyInput = string.Empty; var systemUnderTest = new PhotoAlbumInputValidator(); //act var result = systemUnderTest.ValidateInput(emptyInput); //assert Assert.AreEqual(1, result.ValidationResults.Count); Assert.IsTrue(result.ValidationResults.Select(r => r.ErrorMessage).Contains("Must enter valid command.")); }
public void BadCommandReturnsValidationError() { //arrange var emptyInput = "bad-command 3"; var systemUnderTest = new PhotoAlbumInputValidator(); //act var result = systemUnderTest.ValidateInput(emptyInput); //assert Assert.AreEqual(1, result.ValidationResults.Count); Assert.IsTrue(result.ValidationResults.Select(r => r.ErrorMessage).Contains("Unrecognized command entered")); }
public async Task HappyPathValidator() { //arrange var id = 3; var goodInput = $"photo-album {id}"; var systemUnderTest = new PhotoAlbumInputValidator(); //act var result = systemUnderTest.ValidateInput(goodInput); //assert Assert.AreEqual(id, result.Id); Assert.AreEqual(0, result.ValidationResults.Count); }