Browse Source

Merge pull request #1003 from dotnet-architecture/fix/unit-and-functional-tests-failures

Fix tests projects compilation errors and unit tests failures
pull/1004/head
Miguel Veloso 5 years ago
committed by GitHub
parent
commit
8dea75d1fc
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 39 additions and 4 deletions
  1. +2
    -2
      src/Services/Basket/Basket.API/Controllers/BasketController.cs
  2. +2
    -2
      src/Services/Basket/Basket.UnitTests/Application/BasketWebApiTest.cs
  3. +2
    -0
      src/Services/Basket/Basket.UnitTests/Basket.UnitTests.csproj
  4. +2
    -0
      src/Services/Catalog/Catalog.UnitTests/Catalog.UnitTests.csproj
  5. +2
    -0
      src/Services/Marketing/Marketing.FunctionalTests/Marketing.FunctionalTests.csproj
  6. +27
    -0
      src/Services/Marketing/Marketing.FunctionalTests/Properties/launchSettings.json
  7. +2
    -0
      src/Services/Ordering/Ordering.FunctionalTests/Ordering.FunctionalTests.csproj

+ 2
- 2
src/Services/Basket/Basket.API/Controllers/BasketController.cs View File

@ -41,14 +41,14 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API.Controllers
{
var basket = await _repository.GetBasketAsync(id);
return basket ?? new CustomerBasket(id);
return Ok(basket ?? new CustomerBasket(id));
}
[HttpPost]
[ProducesResponseType(typeof(CustomerBasket), (int)HttpStatusCode.OK)]
public async Task<ActionResult<CustomerBasket>> UpdateBasketAsync([FromBody]CustomerBasket value)
{
return await _repository.UpdateBasketAsync(value);
return Ok(await _repository.UpdateBasketAsync(value));
}
[Route("checkout")]


+ 2
- 2
src/Services/Basket/Basket.UnitTests/Application/BasketWebApiTest.cs View File

@ -55,7 +55,7 @@ namespace UnitTest.Basket.Application
//Assert
Assert.Equal((actionResult.Result as OkObjectResult).StatusCode, (int)System.Net.HttpStatusCode.OK);
Assert.Equal(((CustomerBasket)actionResult.Value).BuyerId, fakeCustomerId);
Assert.Equal((((ObjectResult)actionResult.Result).Value as CustomerBasket).BuyerId, fakeCustomerId);
}
[Fact]
@ -81,7 +81,7 @@ namespace UnitTest.Basket.Application
//Assert
Assert.Equal((actionResult.Result as OkObjectResult).StatusCode, (int)System.Net.HttpStatusCode.OK);
Assert.Equal(((CustomerBasket)actionResult.Value).BuyerId, fakeCustomerId);
Assert.Equal((((ObjectResult)actionResult.Result).Value as CustomerBasket).BuyerId, fakeCustomerId);
}
[Fact]


+ 2
- 0
src/Services/Basket/Basket.UnitTests/Basket.UnitTests.csproj View File

@ -7,6 +7,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="2.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">


+ 2
- 0
src/Services/Catalog/Catalog.UnitTests/Catalog.UnitTests.csproj View File

@ -7,6 +7,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="2.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">


+ 2
- 0
src/Services/Marketing/Marketing.FunctionalTests/Marketing.FunctionalTests.csproj View File

@ -17,6 +17,8 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="2.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="2.2.0" />
<PackageReference Include="xunit" Version="2.4.1" />


+ 27
- 0
src/Services/Marketing/Marketing.FunctionalTests/Properties/launchSettings.json View File

@ -0,0 +1,27 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:7496/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Marketing.FunctionalTests": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:7497/"
}
}
}

+ 2
- 0
src/Services/Ordering/Ordering.FunctionalTests/Ordering.FunctionalTests.csproj View File

@ -17,6 +17,8 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="2.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="2.2.0" />
<PackageReference Include="xunit" Version="2.4.1" />


Loading…
Cancel
Save