Beispiel #1
0
        public async Task Should_Update_Customer_When_Id_Is_Valid_And_Return_NoContentStatusCode()
        {
            //var client = await _factory.GetAuthenticatedClientAsync();

            var command = new UpdateCustomerCommand
            {
                Id           = 1,
                Address      = "...",
                City         = "Berlin",
                CompanyName  = "Benz",
                ContactName  = "Test",
                ContactTitle = "Test",
                Country      = "Germany",
                Fax          = "32323232",
                Phone        = "333333",
                PostalCode   = "44444"
            };
            var content = E2ETestsUtilities.GetRequestContent(command);

            var response = await _authenticatedClient.PutAsync($"/api/customers/update/{command.Id}", content);

            response.EnsureSuccessStatusCode().StatusCode.ShouldBe(HttpStatusCode.NoContent);

            response.StatusCode.ShouldBe(HttpStatusCode.NoContent);
        }
Beispiel #2
0
        public async Task Should_Get_All_Customers()
        {
            //var client = await _factory.GetAuthenticatedClientAsync();

            var response = await _authenticatedClient.GetAsync("/api/customers/getall");

            response.EnsureSuccessStatusCode();

            var vm = await E2ETestsUtilities.GetResponseContent <CustomersListVm>(response);

            vm.ShouldBeOfType <CustomersListVm>();
            vm.Customers.ShouldNotBeEmpty();
        }
Beispiel #3
0
        public async Task Should_Get_A_Customer_With_Valid_Id()
        {
            //var client = await _factory.GetAuthenticatedClientAsync();

            var validId = 1;

            var response = await _authenticatedClient.GetAsync($"/api/customers/get/{validId}");

            response.EnsureSuccessStatusCode();

            var customer = await E2ETestsUtilities.GetResponseContent <CustomerDetailVm>(response);

            Assert.Equal(validId, customer.Id);
        }
        public async Task Should_Create_Customer_And_Return_NoContent_StatusCode()
        {
            var command = new CreateCustomerCommand
            {
                Id           = 11,
                Address      = "...",
                City         = "Berlin",
                CompanyName  = "BMW",
                ContactName  = "Test Contract Name",
                ContactTitle = "Test Contract Title",
                Country      = "Germany",
                Fax          = "1212121",
                Phone        = "4343434",
                PostalCode   = "77777"
            };

            var content  = E2ETestsUtilities.GetRequestContent(command);
            var response = await _anonymousClient.PostAsync($"/api/customers/create", content);

            //var response = await _authenticatedClient.PostAsync($"/api/customers/create", content);

            response.EnsureSuccessStatusCode().StatusCode.ShouldBe(HttpStatusCode.NoContent);
        }