Exemple #1
0
        public void MethodGetAllOnShould_CallRepositoryMethodAll()
        {
            var service = new BookingsService(repositoryMock.Object,
                                              unitOfWorkMock.Object, factoryMock.Object, restaurantsServiceMock.Object);
            var restaurantId = Guid.NewGuid();
            var dateTime     = DateTime.Now;

            service.GetAllOn(dateTime, restaurantId);

            repositoryMock.Verify(r => r.All, Times.Once);
        }
Exemple #2
0
        public void MethodGetAllOnShould_ReturnCorrectResult()
        {
            var restaurantId = Guid.NewGuid();
            var dateTime     = DateTime.Now;
            var booking      = new Booking()
            {
                RestaurantId = restaurantId, DateTime = dateTime
            };
            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.GetAllOn(dateTime, restaurantId);

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