Exemple #1
0
        public void AddExistingItem_NotExistingItemFails()
        {
            //arrange
            var item = new Item {
                Id = Guid.NewGuid()
            };
            var controller = new ItemsController(ShoppingSetupFixture.DataSource.Object);

            //act
            var result = controller.AddExistingItem(item.Id, 1);

            //assert

            Assert.IsInstanceOf <NotFoundResult>(result);
        }
Exemple #2
0
        public void AddExistingItem_ExistingItemPassess()
        {
            //arrange
            var item = new Item {
                Id = Guid.NewGuid()
            };
            var controller = new ItemsController(ShoppingSetupFixture.DataSource.Object);

            ShoppingSetupFixture.Items.Add(item);
            //act
            var result = controller.AddExistingItem(item.Id, 10);

            //assert

            Assert.IsInstanceOf <OkNegotiatedContentResult <Item> >(result);
            Assert.AreEqual(10, ((OkNegotiatedContentResult <Item>)result).Content.Quantity);
        }