public void GetItem_ShouldReturnItemWithSameID()
        {
            var context = new TestUnitTestMockingConext();

            context.Items.Add(GetDemoProduct());

            var controller = new ProductAPIController(context);

            var result = controller.Get(3) as OkNegotiatedContentResult <Product>;

            Assert.IsNotNull(result);

            Assert.AreEqual(3, result.Content.ID);
        }
        public void DeleteItem_ShouldReturnOK()
        {
            var context = new TestUnitTestMockingConext();

            var item = GetDemoProduct();

            context.Items.Add(item);

            var controller = new ProductAPIController(context);

            var result = controller.Delete(3) as OkNegotiatedContentResult <Product>;

            Assert.IsNotNull(result);

            Assert.AreEqual(item.ID, result.Content.Id);
        }
        public void GetItems_ShouldReturnAllItems()
        {
            var context = new TestUnitTestMockingConext();

            context.Items.Add(new Product {
                Id = 1, Name = "Demo1", Price = 20
            });

            context.Items.Add(new Product {
                Id = 2, Name = "Demo2", Price = 30
            });

            context.Items.Add(new Product {
                Id = 3, Name = "Demo3", Price = 40
            });

            var controller = new ProductAPIController(context);

            var result = controller.Get() as TestItemDbSet;

            Assert.IsNotNull(result);

            Assert.AreEqual(3, result.Local.Count);
        }