Ejemplo n.º 1
0
        public void GivenNewItemWithNameDescriptionPriceAndStockAmountAsAdministrator_WhenCreatingNewItem_ThenReturnStatusCode201WithItemDTO()
        {
            //Given
            ItemDTO itemDto1 = new ItemDTO()
            {
                Name = "testItem", Description = "test description", AmountInStock = 5, Price = 10
            };

            _itemServiceStub.CreateNewItem(itemDto1).Returns(itemDto1);

            //When
            CreatedResult result = (CreatedResult)_itemsController.CreateNewItem(itemDto1).Result;

            //Then
            Assert.Equal(201, result.StatusCode);
            Assert.Equal(itemDto1, result.Value);
        }