public async Task cancel_trip_async_should_invoke_repository_method() { var mockedRepository = new Mock <ITripRepository>(); var customerRepository = new Mock <ICustomerRepository>(); mockedRepository.Setup(x => x.GetTripAsync(It.IsAny <Guid>())).ReturnsAsync(DomainTestsHelper.ValidTrip); var mockedMapper = new Mock <ITraveloMapper>(); var mockedDateTimeProvider = new Mock <IDateTimeOffsetProvider>(); var tripService = new TripService(mockedRepository.Object, customerRepository.Object, mockedMapper.Object, mockedDateTimeProvider.Object); var id = Guid.NewGuid(); await tripService.EditTripAsync(id, new TripDTO() { Customers = new List <CustomerDTO>(), StartDate = DateTimeOffset.Now, EndDate = DateTimeOffset.Now + TimeSpan.FromDays(7), Name = "Hyper trip", Destination = "Barzil" }); mockedRepository.Verify(x => x.GetTripAsync(It.IsAny <Guid>()), Times.Once); mockedRepository.Verify(x => x.UpdateTripAsync(It.IsAny <Trip>()), Times.Once); }