Exemple #1
0
        public void RemoveBookingShould_CallRepositoryMethodGetById()
        {
            var id             = Guid.NewGuid();
            var repositoryMock = new Mock <IRepository <Booking> >();
            var unitOfWorkMock = new Mock <IUnitOfWork>();
            var factoryMock    = new Mock <IBookingFactory>();

            var service = new Services.BookingService(repositoryMock.Object,
                                                      unitOfWorkMock.Object, factoryMock.Object);

            service.RemoveBooking(id);

            repositoryMock.Verify(r => r.GetById(id), Times.Once);
        }
Exemple #2
0
        public void RemoveBookingShould_CallUnitOfWorkMethodCommit()
        {
            var id             = Guid.NewGuid();
            var repositoryMock = new Mock <IRepository <Booking> >();
            var unitOfWorkMock = new Mock <IUnitOfWork>();
            var factoryMock    = new Mock <IBookingFactory>();

            var booking = new Booking()
            {
                Id = id
            };

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

            var service = new Services.BookingService(repositoryMock.Object,
                                                      unitOfWorkMock.Object, factoryMock.Object);

            service.RemoveBooking(id);

            unitOfWorkMock.Verify(r => r.Commit(), Times.Once);
        }