Browse Source

Added CatalogService tests

pull/49/merge
Javier Suárez Ruiz 8 years ago
parent
commit
84c09e6236
3 changed files with 71 additions and 3 deletions
  1. +17
    -0
      src/Mobile/eShopOnContainers/eShopOnContainers.UnitTests/BasketServiceTests.cs
  2. +53
    -3
      src/Mobile/eShopOnContainers/eShopOnContainers.UnitTests/CatalogServiceTests.cs
  3. +1
    -0
      src/Mobile/eShopOnContainers/eShopOnContainers.UnitTests/eShopOnContainers.UnitTests.csproj

+ 17
- 0
src/Mobile/eShopOnContainers/eShopOnContainers.UnitTests/BasketServiceTests.cs View File

@ -0,0 +1,17 @@
using eShopOnContainers.Core.Services.Catalog;
using System.Threading.Tasks;
using Xunit;
namespace eShopOnContainers.UnitTests
{
public class BasketServiceTests
{
[Fact]
public async Task GetFakeBasketTest()
{
var catalogMockService = new CatalogMockService();
var result = await catalogMockService.GetCatalogAsync();
Assert.NotEqual(0, result.Count);
}
}
}

+ 53
- 3
src/Mobile/eShopOnContainers/eShopOnContainers.UnitTests/CatalogServiceTests.cs View File

@ -1,4 +1,5 @@
using eShopOnContainers.Core.Services.Catalog;
using eShopOnContainers.Core.Services.RequestProvider;
using System.Threading.Tasks;
using Xunit;
@ -9,9 +10,58 @@ namespace eShopOnContainers.UnitTests
[Fact]
public async Task GetFakeCatalogTest()
{
var catalogMockService = new CatalogMockService();
var result = await catalogMockService.GetCatalogAsync();
Assert.NotEqual(0, result.Count);
var catalogMockService = new CatalogMockService();
var catalog = await catalogMockService.GetCatalogAsync();
Assert.NotEqual(0, catalog.Count);
}
[Fact]
public async Task GetCatalogTest()
{
var requestProvider = new RequestProvider();
var catalogService = new CatalogService(requestProvider);
var catalog = await catalogService.GetCatalogAsync();
Assert.NotEqual(0, catalog.Count);
}
[Fact]
public async Task GetFakeCatalogBrandTest()
{
var catalogMockService = new CatalogMockService();
var catalogBrand = await catalogMockService.GetCatalogBrandAsync();
Assert.NotEqual(0, catalogBrand.Count);
}
[Fact]
public async Task GetCatalogBrandTest()
{
var requestProvider = new RequestProvider();
var catalogService = new CatalogService(requestProvider);
var catalogBrand = await catalogService.GetCatalogBrandAsync();
Assert.NotEqual(0, catalogBrand.Count);
}
[Fact]
public async Task GetFakeCatalogTypeTest()
{
var catalogMockService = new CatalogMockService();
var catalogType = await catalogMockService.GetCatalogTypeAsync();
Assert.NotEqual(0, catalogType.Count);
}
[Fact]
public async Task GetCatalogTypeTest()
{
var requestProvider = new RequestProvider();
var catalogService = new CatalogService(requestProvider);
var catalogType = await catalogService.GetCatalogTypeAsync();
Assert.NotEqual(0, catalogType.Count);
}
}
}

+ 1
- 0
src/Mobile/eShopOnContainers/eShopOnContainers.UnitTests/eShopOnContainers.UnitTests.csproj View File

@ -34,6 +34,7 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Compile Include="BasketServiceTests.cs" />
<Compile Include="CatalogServiceTests.cs" />
<Compile Include="DummyTests.cs" />
<Compile Include="OrdersServiceTests.cs" />


Loading…
Cancel
Save