public void TestsGetProductsInSectionWithEmptySection() { fakeApi = new FakeApiRequestSend(); var controller = new ApiController(fakeApi); Assert.Throws <Exception>(() => controller.GetProductsInSection("")); }
public void TestsGetMostExpensiveProduct() { fakeApi = new FakeApiRequestSend(); var controller = new ApiController(fakeApi); var expectedProduct = new Product { Id = 2, Price = 40, ProductName = "Lamp", Section = "B", Weight = 5 }; var actualProduct = controller.GetMostExpensiveProduct(); Assert.Equal(expectedProduct, actualProduct); }
public void TestsGetProductsInSectionWithRealSection() { fakeApi = new FakeApiRequestSend(); var controller = new ApiController(fakeApi); List <Product> expectedProducts = new List <Product>() { new Product { Id = 1, Price = 32, ProductName = "Table", Section = "B", Weight = 57 }, new Product { Id = 2, Price = 40, ProductName = "Lamp", Section = "B", Weight = 5 } }; List <Product> actualProducts = controller.GetProductsInSection("B").ToList(); Assert.Equal(expectedProducts, actualProducts); }