Exemple #1
0
 public void Create_New_Person_With_Email_That_Does_Not_Already_Exist()
 {
     using (var context = GetContextWithData())
     {
         var validator = new CreatePersonCommandValidator(context);
         var result    = validator.TestValidate(new CreatePersonCommand
         {
             Id      = new Guid(),
             Name    = "Vincent",
             Email   = "*****@*****.**",
             IsAdmin = false
         });
     }
 }
Exemple #2
0
 public void Create_New_Person_With_Name_That_Does_Not_Already_Exist()
 {
     using (var context = GetContextWithData())
     {
         var validator = new CreatePersonCommandValidator(context);
         var result    = validator.TestValidate(new CreatePersonCommand
         {
             Id      = new Guid(),
             Name    = "Julia",
             Email   = "*****@*****.**",
             IsAdmin = false
         });
         result.ShouldNotHaveValidationErrorFor(x => x);
     }
 }
Exemple #3
0
 public void Create_New_Person_With_Name_That_Already_Exists_Throws_Exception()
 {
     using (var context = GetContextWithData())
     {
         var validator = new CreatePersonCommandValidator(context);
         var result    = validator.TestValidate(new CreatePersonCommand
         {
             Id      = new Guid(),
             Name    = context.Persons.FirstOrDefault()?.Name,
             Email   = "*****@*****.**",
             IsAdmin = false
         });
         result.ShouldHaveValidationErrorFor(x => x);
     }
 }