public void GetProduct_ShouldNotFindProduct() { var controller = new WebApi_UnitTestController(GetTestProducts()); var result = controller.GetProduct(999); Assert.IsInstanceOfType(result, typeof(NotFoundResult)); }
public async Task GetAllProductsAsync_ShouldReturnAllProducts() { var testProducts = GetTestProducts(); var controller = new WebApi_UnitTestController(testProducts); var result = await controller.GetAllProductsAsync() as List <WebApi_Test>; Assert.AreEqual(testProducts.Count, result.Count); }
public void GetAllProducts_ShouldReturnAllProducts() { var testProducts = GetTestProducts(); var controller = new WebApi_UnitTestController(testProducts); var result = controller.GetAllProducts() as List <WebApi_Test>; Assert.AreEqual(testProducts.Count, result.Count); }
public async Task GetProductAsync_ShouldReturnCorrectProduct() { var testProducts = GetTestProducts(); var controller = new WebApi_UnitTestController(testProducts); var result = await controller.GetProductAsync(4) as OkNegotiatedContentResult <WebApi_Test>; Assert.IsNotNull(result); Assert.AreEqual(testProducts[3].Name, result.Content.Name); }