From 84c09e62364d7614b5f6c40ff851687a76050c23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Su=C3=A1rez=20Ruiz?= Date: Thu, 24 Nov 2016 13:49:59 +0100 Subject: [PATCH] Added CatalogService tests --- .../BasketServiceTests.cs | 17 ++++++ .../CatalogServiceTests.cs | 56 ++++++++++++++++++- .../eShopOnContainers.UnitTests.csproj | 1 + 3 files changed, 71 insertions(+), 3 deletions(-) create mode 100644 src/Mobile/eShopOnContainers/eShopOnContainers.UnitTests/BasketServiceTests.cs diff --git a/src/Mobile/eShopOnContainers/eShopOnContainers.UnitTests/BasketServiceTests.cs b/src/Mobile/eShopOnContainers/eShopOnContainers.UnitTests/BasketServiceTests.cs new file mode 100644 index 000000000..a14ce5ee0 --- /dev/null +++ b/src/Mobile/eShopOnContainers/eShopOnContainers.UnitTests/BasketServiceTests.cs @@ -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); + } + } +} \ No newline at end of file diff --git a/src/Mobile/eShopOnContainers/eShopOnContainers.UnitTests/CatalogServiceTests.cs b/src/Mobile/eShopOnContainers/eShopOnContainers.UnitTests/CatalogServiceTests.cs index 586b7cb39..bc3d2691b 100644 --- a/src/Mobile/eShopOnContainers/eShopOnContainers.UnitTests/CatalogServiceTests.cs +++ b/src/Mobile/eShopOnContainers/eShopOnContainers.UnitTests/CatalogServiceTests.cs @@ -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); } } } \ No newline at end of file diff --git a/src/Mobile/eShopOnContainers/eShopOnContainers.UnitTests/eShopOnContainers.UnitTests.csproj b/src/Mobile/eShopOnContainers/eShopOnContainers.UnitTests/eShopOnContainers.UnitTests.csproj index dc309254a..92d3937a4 100644 --- a/src/Mobile/eShopOnContainers/eShopOnContainers.UnitTests/eShopOnContainers.UnitTests.csproj +++ b/src/Mobile/eShopOnContainers/eShopOnContainers.UnitTests/eShopOnContainers.UnitTests.csproj @@ -34,6 +34,7 @@ 4 +