Beispiel #1
0
        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);
        }
Beispiel #2
0
        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."));
        }