Exemplo n.º 1
0
        public void MethodGetAllOfRestaurantShould_CallRepositoryMethodAll()
        {
            var service = new BookingsService(repositoryMock.Object,
                                              unitOfWorkMock.Object, factoryMock.Object, restaurantsServiceMock.Object);
            var restaurantId = Guid.NewGuid();

            service.GetAllOfRestaurant(restaurantId);

            repositoryMock.Verify(r => r.All, Times.Once);
        }
Exemplo n.º 2
0
        public void MethodGetAllOfRestaurantShould_ReturnCorrectResult()
        {
            var restaurantId = Guid.NewGuid();
            var booking      = new Booking()
            {
                RestaurantId = restaurantId
            };
            var list = new List <Booking>()
            {
                booking
            };

            repositoryMock.Setup(r => r.All).Returns(list.AsQueryable());

            var service = new BookingsService(repositoryMock.Object,
                                              unitOfWorkMock.Object, factoryMock.Object, restaurantsServiceMock.Object);

            var result = service.GetAllOfRestaurant(restaurantId);

            Assert.AreSame(booking, result.ToList().First());
        }