Added CatalogService tests

This commit is contained in:
Javier Suárez Ruiz 2016-11-24 13:49:59 +01:00
parent 009411133d
commit 84c09e6236
3 changed files with 71 additions and 3 deletions

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

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

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" />