예제 #1
0
        public async Task Post_WithInvalidName_ReturnsExpectedProblemDetails(TestProductInputModel productInputModel,
                                                                             Action <KeyValuePair <string, string[]> > validator)
        {
            var response = await _client.PostAsJsonAsync("", productInputModel, JsonSerializerHelper.DefaultSerialisaOptions);

            var problemDetails = await response.Content.ReadFromJsonAsync <ValidationProblemDetails>();

            Assert.Collection(problemDetails.Errors, validator);
        }
예제 #2
0
        public async Task Post_WithoutName_ReturnsBadRequest(TestProductInputModel productInputModel)
        {
            var response = await _client.PostAsJsonAsync("", productInputModel, JsonSerializerHelper.DefaultSerialisaOptions);

            Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
        }
        public async Task Post_WithoutName_ReturnsBadRequestTheory(TestProductInputModel model)
        {
            var response = await _client.PostAsJsonAsync("", model);

            Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
        }