Ejemplo n.º 1
0
        public async Task HandleCaretakerRequest_DeclineRequest_Succeeds()
        {
            (await _client.AuthenticateUserAsync("twilliams", "password")).AddAuthorization(_httpClient);

            SuccessfulRequestDto response = null;

            Assert.Null(await Record.ExceptionAsync(async() =>
                                                    response = await _client.Caretaker_HandleCaretakerRequestAsync(Guid.Parse("f61ee92d-792e-45dd-a664-309178a71830"),
                                                                                                                   new HandleCaretakerForCustomerRequestDto {
                AcceptRequest = false
            })));
            Assert.NotNull(response);

            PendingCaretakerRequestsDto response1 = null;

            Assert.Null(await Record.ExceptionAsync(async() => response1 = await _client.Caretaker_GetPendingCaretakerRequestsAsync()));
            Assert.NotNull(response1);
            Assert.Equal(2, response1.CaretakerRequests.Count());

            AssignedCustomersForCaretakerDto response2 = null;

            Assert.Null(await Record.ExceptionAsync(async() => response2 = await _client.Caretaker_GetAssignedCustomersAsync()));
            Assert.NotNull(response2);
            Assert.Empty(response2.Customers);
        }
Ejemplo n.º 2
0
        public async Task GetAssignedCustomers_ValidRequest_Succeeds()
        {
            (await _client.AuthenticateUserAsync("twilliams", "password")).AddAuthorization(_httpClient);

            AssignedCustomersForCaretakerDto response = null;

            Assert.Null(await Record.ExceptionAsync(async() =>
                                                    response = await _client.Caretaker_GetAssignedCustomersAsync()));
            Assert.NotNull(response);
            Assert.Empty(response.Customers);

            SuccessfulRequestDto response1 = null;

            Assert.Null(await Record.ExceptionAsync(async() =>
                                                    response1 = await _client.Caretaker_HandleCaretakerRequestAsync(Guid.Parse("f61ee92d-792e-45dd-a664-309178a71830"),
                                                                                                                    new HandleCaretakerForCustomerRequestDto {
                AcceptRequest = true
            })));
            Assert.NotNull(response1);

            response = null;
            Assert.Null(await Record.ExceptionAsync(async() =>
                                                    response = await _client.Caretaker_GetAssignedCustomersAsync()));
            Assert.NotNull(response);
            Assert.Single(response.Customers);
            var customer = response.Customers.First();

            Assert.NotNull(customer);
            Assert.Equal("Matt", customer.FirstName);
            Assert.Equal("Wilson", customer.LastName);
            Assert.Equal("mwilson", customer.Username);
            Assert.Equal("+4418821000", customer.PhoneNumber);
        }