Exemplo n.º 1
0
        public void AddFilmToOrderTest()
        {
            //Act
            orderService.AddFilmToOrder(1L);
            orderService.AddFilmToOrder(2L);

            //Assert
            order.Verify(o => o.AddFilm(It.Is <Film>(f => f.Id == 1)));
            order.Verify(o => o.AddFilm(It.Is <Film>(f => f.Id == 2)));
        }
Exemplo n.º 2
0
        public void IT_SaveOrder()
        {
            //Arrange
            IOrderService   orderService   = new OrderService(new EfFilmRepository(), new EFOrderRepository(), new Order());
            IFilmRepository filmRepository = new EfFilmRepository();

            //act
            orderService.AddFilmToOrder(1);
            orderService.SaveOrder("Ben");
            long film1StockLevelAfterCallingSaveOrder = filmRepository.SelectById(1).Stock;

            //Assert
            Assert.AreEqual(9, film1StockLevelAfterCallingSaveOrder);
        }