예제 #1
0
        public void AddMenuItem_Should_Add_MenuItem()
        {
            //Arrange
            var testMenuItems = new List <MenuItem>();

            _mockMenuRepo.Setup(r => r.Add(It.IsAny <MenuItem>()))
            .Callback <MenuItem>(m => testMenuItems.Add(m));
            _mockMenuRepo.Setup(r => r.GetAll()).Returns(testMenuItems);

            var menuManager = new MenuManager(_mockUnitOfWork.Object);

            //Act
            menuManager.AddMenuItem(new MenuItemDto());
            var testItemsCount = menuManager.GetMenuItems().Count();

            //Assert
            Assert.IsTrue(testItemsCount == 1);
        }