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);
        }
        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);
        }