Exemplo n.º 1
0
        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"));
        }
Exemplo n.º 2
0
        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));
        }