Пример #1
0
		public async Task CatalogProduct()
		{
			// Arrange
			CatalogController controller = new CatalogController(catalogService.Object, settingsService.Object);

			// Act
			ViewResult result = await controller.Product("15") as ViewResult;

			// Assert
			Assert.IsNotNull(result);
			Product product = result.Model as Product;
			Assert.IsNotNull(product);
			Assert.AreEqual("15", product.Name);
			
		}
Пример #2
0
		public async Task CatalogIndex()
		{
			// Arrange
			CatalogController controller = new CatalogController(catalogService.Object, settingsService.Object);

			// Act
			ViewResult result = await controller.Index(null) as ViewResult;

			// Assert
			IPagedList<Product> pagedList = result.Model as IPagedList<Product>;
			Assert.IsNotNull(pagedList);
			Assert.AreEqual(pageSize, pagedList.Count);
			Assert.AreEqual(Math.Ceiling((float)totalProducts / (float)pageSize), pagedList.PageCount);
			Assert.AreEqual(1, pagedList.PageNumber);
			Assert.AreEqual(totalProducts, pagedList.TotalItemCount);
		}