diff --git a/sample/Ardalis.Result.SampleWeb.FunctionalTests/PersonControllerCreate.cs b/sample/Ardalis.Result.SampleWeb.FunctionalTests/PersonControllerCreate.cs index a1c8838..228a534 100644 --- a/sample/Ardalis.Result.SampleWeb.FunctionalTests/PersonControllerCreate.cs +++ b/sample/Ardalis.Result.SampleWeb.FunctionalTests/PersonControllerCreate.cs @@ -29,9 +29,13 @@ public PersonControllerCreate(WebApplicationFactory factory) [InlineData(ENDPOINT_POST_ROUTE)] public async Task ReturnsConflictGivenExistPerson(string route) { - var firstName = "John"; - var lastName = "Smith"; - var response = await SendCreateRequest(route, firstName, lastName); + var createPersonRequestDto = new CreatePersonRequestDto + { + FirstName = "John", + LastName = "Smith" + }; + var json = JsonConvert.SerializeObject(createPersonRequestDto); + var response = await _client.PostAsync(route, new StringContent(json, Encoding.UTF8, "application/json")); Assert.Equal(HttpStatusCode.Conflict, response.StatusCode); var stringResponse = await response.Content.ReadAsStringAsync(); @@ -39,16 +43,7 @@ public async Task ReturnsConflictGivenExistPerson(string route) var problemDetails = JsonConvert.DeserializeObject(stringResponse); Assert.Contains("There was a conflict.", problemDetails.Title); - Assert.Contains("Next error(s) occured:* Person (John Smith) is exist\r\n", problemDetails.Detail); + Assert.Contains("Next error(s) occured:* Person (John Smith) is exist", problemDetails.Detail); Assert.Equal(409, problemDetails.Status); } - - private async Task SendCreateRequest(string route, string firstName, string lastName) - { - var createPersonRequestDto = new CreatePersonRequestDto{ FirstName = firstName, LastName = lastName }; - var json = JsonConvert.SerializeObject(createPersonRequestDto); - var data = new StringContent(json, Encoding.UTF8, "application/json"); - - return await _client.PostAsync(route, data); - } } diff --git a/src/Ardalis.Result.AspNetCore/Ardalis.Result.AspNetCore.csproj b/src/Ardalis.Result.AspNetCore/Ardalis.Result.AspNetCore.csproj index 5eb81fd..5d3817c 100644 --- a/src/Ardalis.Result.AspNetCore/Ardalis.Result.AspNetCore.csproj +++ b/src/Ardalis.Result.AspNetCore/Ardalis.Result.AspNetCore.csproj @@ -6,9 +6,9 @@ Adds ASP.NET Core filters that translate from Result to ActionResult. Adds ASP.NET Core filters that translate from Result to ActionResult. result pattern web api aspnetcore mvc - PRs 92 and 112. Adding support for .NET 7 and ability to improve Swagger/OpenAPI specifications when using the TranslateResultToActionResult attribute. + PR 132. Add Result.Conflict Ardalis.Result.AspNetCore - 7.0.0 + 7.1.0 diff --git a/src/Ardalis.Result.FluentValidation/Ardalis.Result.FluentValidation.csproj b/src/Ardalis.Result.FluentValidation/Ardalis.Result.FluentValidation.csproj index 1000f2b..f0bb12d 100644 --- a/src/Ardalis.Result.FluentValidation/Ardalis.Result.FluentValidation.csproj +++ b/src/Ardalis.Result.FluentValidation/Ardalis.Result.FluentValidation.csproj @@ -6,9 +6,9 @@ A simple package to implement the FluentValidation in Result package. A simple package to implement the FluentValidation in Result package. result;pattern;web;api;aspnetcore;mvc;FluentValidation;Validation - PRs 92 and 112. Adding support for .NET 7. + PR 132. Add Result.Conflict Ardalis.Result.FluentValidation - 7.0.0 + 7.1.0 diff --git a/src/Ardalis.Result/Ardalis.Result.csproj b/src/Ardalis.Result/Ardalis.Result.csproj index 7f14aae..79f06fb 100644 --- a/src/Ardalis.Result/Ardalis.Result.csproj +++ b/src/Ardalis.Result/Ardalis.Result.csproj @@ -6,9 +6,9 @@ A simple package to implement the Result pattern for returning from services. A simple package to implement the Result pattern for returning from services. result pattern web api aspnetcore mvc - PRs 92 and 112. Adding support for .NET 7 + PR 132. Add Result.Conflict Ardalis.Result - 7.0.0 + 7.1.0