public void existing_email_validation() { var email = $"{Guid.NewGuid().ToString()}@email.com"; var account = new AccountModel { EmailAddress = email, Password = "******", }; account.Save(); var validator = new AccountModel.Validator(); validator.ShouldHaveValidationErrorFor(v => v.EmailAddress, email); }
public void saving_a_new_account() { var email = $"{Guid.NewGuid().ToString()}@email.com"; var account = new AccountModel { EmailAddress = email, Password = "******", }; var validator = new AccountModel.Validator(); validator.ShouldNotHaveValidationErrorFor(v => v.Password, account.Password); var cnt = new AccountController(settings); var res = cnt.Save(account); res.Should().BeOfType <OkObjectResult>(); }