예제 #1
0
        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);
        }
예제 #2
0
        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>();
        }