public async Task RegisterCustomerTest() { await CustomersModule.ExecuteCommandAsync(new RegisterNewCustomerCommand( CustomerSampleData.Id, CustomerSampleData.Email, CustomerSampleData.Password, CustomerSampleData.FirstName, CustomerSampleData.LastName )); var registration = await CustomersModule.ExecuteQueryAsync(new GetCustomerRegistrationQuery( CustomerSampleData.Id )); await CustomersModule.ExecuteCommandAsync(new ConfirmRegistrationCommand( CustomerSampleData.Id, registration.ActivationCode )); var customer = await CustomersModule.ExecuteQueryAsync( new GetCustomerQuery(CustomerSampleData.Id) ); Assert.That(customer, Is.Not.Null); Assert.That(customer.Id, Is.EqualTo(CustomerSampleData.Id)); Assert.That(customer.Email, Is.EqualTo(CustomerSampleData.Email)); Assert.That(customer.FirstName, Is.EqualTo(CustomerSampleData.FirstName)); Assert.That(customer.LastName, Is.EqualTo(CustomerSampleData.LastName)); Assert.That(customer.Password, Is.EqualTo(registration.Password)); }
public async Task Authenticate_WithInvalidPassword_ShouldFail() { await CustomersModule.ExecuteCommandAsync(new CreateCustomerCommand( CustomerSampleData.Id, CustomerSampleData.Email, CustomerSampleData.Password, CustomerSampleData.FirstName, CustomerSampleData.LastName )); var authenticationResult = await CustomersModule.Authenticate( CustomerSampleData.Email, "invalidPass1237" ); Assert.That(authenticationResult.Authenticated, Is.False); Assert.That(authenticationResult.Error, Is.EqualTo("Invalid credentials")); }
public async Task Authenticate_WithValidCredentials_ShouldSucceed() { await CustomersModule.ExecuteCommandAsync(new CreateCustomerCommand( CustomerSampleData.Id, CustomerSampleData.Email, CustomerSampleData.Password, CustomerSampleData.FirstName, CustomerSampleData.LastName )); var authenticationResult = await CustomersModule.Authenticate( CustomerSampleData.Email, CustomerSampleData.Password ); Assert.That(authenticationResult.Authenticated, Is.True); Assert.That(authenticationResult.Customer, Is.Not.Null); Assert.That(authenticationResult.Customer.Id, Is.EqualTo(CustomerSampleData.Id)); }
public async Task CreateCustomerTest() { await CustomersModule.ExecuteCommandAsync(new CreateCustomerCommand( CustomerSampleData.Id, CustomerSampleData.Email, CustomerSampleData.Password, CustomerSampleData.FirstName, CustomerSampleData.LastName )); var customer = await CustomersModule.ExecuteQueryAsync( new GetCustomerQuery(CustomerSampleData.Id) ); Assert.That(customer, Is.Not.Null); Assert.That(customer.Id, Is.EqualTo(CustomerSampleData.Id)); Assert.That(customer.Email, Is.EqualTo(CustomerSampleData.Email)); Assert.That(customer.FirstName, Is.EqualTo(CustomerSampleData.FirstName)); Assert.That(customer.LastName, Is.EqualTo(CustomerSampleData.LastName)); }