public void CanCreateAccountRegistrationRequestFromSourceDataWithCorrectValues() { var regForm = new Registration { AddressLine1 = "Line1", AddressLine2 = "Line2", County = "county", Email = "*****@*****.**", OrganisationName = "Orgname", Password = "******", Postcode = "SK8XXX", Town = "Township" }; var result = _carb.Build(regForm); Assert.That(result.Address.Country, Is.EqualTo("United Kingdom")); Assert.That(result.Address.CountyOrState, Is.EqualTo(regForm.County)); Assert.That(result.Address.Line1, Is.EqualTo(regForm.AddressLine1)); Assert.That(result.Address.Line2, Is.EqualTo(regForm.AddressLine2)); Assert.That(result.Address.PostcodeOrZipcode, Is.EqualTo(regForm.Postcode)); Assert.That(result.Address.TownOrCity, Is.EqualTo(regForm.Town)); Assert.That(result.Email, Is.EqualTo(regForm.Email)); Assert.That(result.FirstName, Is.EqualTo(regForm.OrganisationName)); Assert.That(result.LastName, Is.EqualTo("Funeral Director")); Assert.That(result.Password, Is.EqualTo(regForm.Password)); Assert.That(result.Title, Is.EqualTo("Other")); }
public ActionResult Register(Registration model, string returnUrl) { if (!ModelState.IsValid) return View("Index", new Account { Registration = model, Login = new Login() }); if (_apiClient.RegisterAccount(model) != model.Email) { TempData["errorMessage"] = "Account creation unsuccessful."; return View("Index", new Account { Registration = model }); } return Login(new Login { Email = model.Email, LoginPassword = model.Password }, returnUrl); }
public string RegisterAccount(Registration registration) { var request = _accountRegBuilder.Build(registration); return _jg.Account.Create(request); }
public void Register_InvalidModel_DoesntCallApi() { var model = new Registration(); _controller.ModelState.AddModelError("key", "error"); var result = _controller.Register(model, null); _apiClient.Verify(x => x.RegisterAccount(model), Times.Never()); Assert.That(((ViewResult)result).ViewName, Is.EqualTo("Index")); }
public void Register_CreatesAccount_AttemptsLogin() { const string email = "email"; const string password = "******"; var model = new Registration { Email = email, Password = password}; _apiClient.Setup(x => x.RegisterAccount(model)).Returns(email); _apiClient.Setup(c => c.ValidateAccount(email, password)).Returns(true); var result = _controller.Register(model, null); _apiClient.Verify(x => x.RegisterAccount(model)); Assert.That(_session.Authenticated, Is.True); }
public void RegisterAccount_ValidRequest_CallsSdk() { _sdk.Setup(s => s.Account.Create(It.IsAny<CreateAccountRequest>())); var model = new Registration(); _client.RegisterAccount(model); _sdk.Verify(s => s.Account.Create(It.IsAny<CreateAccountRequest>())); }
public void RegisterAccount_AccountCreated_ReturnsSameEmail() { const string email = "email"; _sdk.Setup(s => s.Account.Create(It.IsAny<CreateAccountRequest>())).Returns(email); var model = new Registration { Email = email }; var result = _client.RegisterAccount(model); Assert.That(result, Is.EqualTo(email)); }