public void TestProductsControllerGetByIdReturnsNotFound()
        {
            ProductsController ctrl = new ProductsController(_mockedRepository.Object);
            IHttpActionResult actionResult = ctrl.Get(999);

            // Assert
            Assert.IsInstanceOfType(actionResult, typeof(NotFoundResult));
        }
        public void TestProductsControllerGetAll()
        {
            ProductsController ctrl = new ProductsController(_mockedRepository.Object);

            var products = ctrl.Get();

            Assert.IsInstanceOfType(products, typeof (OkNegotiatedContentResult<IList<Product>>));
        }
        public void TestProductsControllerGetById()
        {
            ProductsController ctrl = new ProductsController(_mockedRepository.Object);
            IHttpActionResult actionResult = ctrl.Get(3);
            var contentResult = actionResult as OkNegotiatedContentResult<Product>;

            // Assert
            Assert.IsNotNull(contentResult);
            Assert.IsNotNull(contentResult.Content);
            Assert.AreEqual(3, contentResult.Content.ProductId);
        }
 public void TestCreateNewProduct()
 {
     ProductsController ctrl = new ProductsController(_mockedRepository.Object);
     Product p = new Product();
     p.ProductName = "New Product";
     p.Description = "A new product description";
     p.Price = 100.00M;
     p.ProductCode = "XYZ 123";
     p.ReleaseDate = DateTime.Now;
     var savedProduct = ctrl.Post(p);
     Assert.IsNotNull(savedProduct);
 }