Beispiel #1
0
        public void MethodGetByIdShould_CallRepositoryMethodGetById()
        {
            var id      = Guid.NewGuid();
            var service = new BookingsService(repositoryMock.Object,
                                              unitOfWorkMock.Object, factoryMock.Object, restaurantsServiceMock.Object);

            service.GetById(id);

            repositoryMock.Verify(r => r.GetById(id));
        }
Beispiel #2
0
        public void MethodGetByIdShould_ReturnCorrectValue()
        {
            var id      = Guid.NewGuid();
            var booking = new Booking()
            {
                Id = id
            };

            repositoryMock.Setup(r => r.GetById(id)).Returns(booking);

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

            var result = service.GetById(id);

            Assert.AreSame(booking, result);
        }