public void GetAllProducts_ShouldReturnAllProducts()
 {
     var testProducts = GetTestProducts();
     var controller = new SimpleProductController(testProducts);
     var result = controller.GetAllProducts() as List<Product>;
     Assert.AreEqual(testProducts.Count, result.Count);
 }
Пример #2
0
        public void GetProduct_ShouldNotFindProduct()
        {
            var controller = new SimpleProductController(GetTestProducts());

            var result = controller.GetProduct(999);

            Assert.IsInstanceOfType(result, typeof(NotFoundResult));
        }
        public async Task GetAllProductsAsync_ShouldReturnAllProducts()
        {
            var testProducts = GetTestProducts();
            var controller   = new SimpleProductController(testProducts);
            var result       = await controller.GetAllProductsAsync() as List <Products>;

            Assert.AreEqual(testProducts.Count, result.Count);
        }
Пример #4
0
        public void TestMethod1()
        {
            var testProducts = GetTestProducts();
            var tarefas
            var controller = new SimpleProductController(testProducts);

            var result = controller.GetAllProducts() as List<Product>;
            Assert.AreEqual(testProducts.Count, result.Count);
        }
Пример #5
0
        public async Task GetProductAsync_ShouldReturnCorrectProduct()
        {
            var testProducts = GetTestProducts();
            var controller   = new SimpleProductController(testProducts);

            var result = await controller.GetProductAsync(4) as OkNegotiatedContentResult <Product>;

            Assert.IsNotNull(result);
            Assert.AreEqual(testProducts[3].Name, result.Content.Name);
        }