public void Process_EmailIsValid_NoErrorsInArgs() { // arrange var comment = new Comment { AuthorEmail = "*****@*****.**", Text = "comment", AuthorName = "name" }; var args = new ValidateCommentArgs(comment, new NameValueCollection()); var sut = new EmailProvided(); // act sut.Process(args); // assert Assert.That(args.Errors, Is.Empty); }
public void Process_EmailIsInvalid_AddsErrorToArgs(string email) { // arrange var comment = new Comment { AuthorEmail = email, Text = "comment", AuthorName = "name" }; var args = new ValidateCommentArgs(comment, new NameValueCollection()); var sut = new EmailProvided(); // act sut.Process(args); // assert var errorText = args.Errors.First(); Assert.That(errorText, Is.EqualTo("Required field Email is missing.")); }