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); }
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); }