Exemplo n.º 1
0
        public void ShouldReturnValidInventoryListWhenPutValidEatableItem()
        {
            var etableName = "whatever";
            var etableId   = 2;

            var response = _controller.Put(etableId, new Web.Models.EatableInput {
                Name = etableName, Price = 1.0M
            });
            var inventoryList = ((OkNegotiatedContentResult <IList <Web.Models.Eatable> >)response).Content.ToList();

            Assert.IsNotNull(inventoryList);
        }
Exemplo n.º 2
0
        public void Integration_ShouldUpdateEatableItem()
        {
            var newEatable = new Web.Models.EatableInput {
                Name = "new-cockie", Price = 1.00M
            };
            var updatedEatable = new Web.Models.EatableInput {
                Name = "new-cockie with seasalt", Price = 1.50M
            };
            var newResponse   = _controller.Post(newEatable);
            var newResult     = ((OkNegotiatedContentResult <Web.Models.Eatable>)newResponse).Content;
            var response      = _controller.Put(newResult.Id, updatedEatable);
            var inventoryList = ((OkNegotiatedContentResult <IList <Web.Models.Eatable> >)response).Content.ToList();

            Assert.IsNotNull(inventoryList);
            Assert.IsTrue(inventoryList.Count > 0);
            Assert.IsNotNull(inventoryList.Where(i => (i.Name == updatedEatable.Name)).FirstOrDefault());
        }