Advertisement
Guest User

Untitled

a guest
Jul 25th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. [Theory]
  2. [MemberData("StringValidatorValidateEmailAddressShouldPopulateErrorCollection")]
  3. public void StringValidator_ValidateEmailAddress_ShouldPopulateErrorCollection(
  4. int order,
  5. string emailAddress,
  6. List<string> errorCollection,
  7. bool shouldThroException,
  8. int expectedAmountOfErrorsInErrorCollection)
  9. {
  10. // Given
  11.  
  12. // When
  13. Action action = () => this.stringValidator.ValidateEmailAddress(emailAddress, errorCollection);
  14.  
  15. // Then
  16. if (shouldThroException)
  17. {
  18. action.ShouldThrowExactly<InvalidEmailAddressDigitalLibraryValidationException>();
  19. }
  20. else
  21. {
  22. action.ShouldNotThrow();
  23. }
  24.  
  25. errorCollection.Count.Should().Be(expectedAmountOfErrorsInErrorCollection);
  26. }
  27.  
  28. public static IEnumerable<object[]> StringValidatorValidateEmailAddressShouldPopulateErrorCollection
  29. {
  30. get
  31. {
  32. return new List<object[]>
  33. {
  34. new object[] { 3, "asd@c", new List<string>(), false, 1 },
  35.  
  36. };
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement