public async Task Detail_ShouldDoDistanceAndKereseneCalculation() { // Arrange var airplane = new Airplane { Id = 1, Name = "Airplane1", KeroseneConsumption = 10 }; var airport = new Airport { Id = 1, Name = "Airport1", Longitude = 33.132, Latitude = -6.132 }; IEnumerable <Flight> flights = new List <Flight> { new Flight { Id = 1, From = airport, To = airport, Airplane = airplane } }; _unitOfWorkMock.Setup(uof => uof.FlightRepository.GetAsync(It.IsAny <Expression <Func <Flight, bool> > >(), It.IsAny <Func <IQueryable <Flight>, IOrderedQueryable <Flight> > >(), It.IsAny <string>())).Returns(Task.FromResult(flights)); // Act var result = await _flightsController.Detail(1); // Assert var viewResult = Assert.IsType <ViewResult>(result); Assert.IsType <FlightDetailViewModel>(viewResult.Model); _unitOfWorkMock.Verify(uof => uof.FlightRepository.GetAsync(It.IsAny <Expression <Func <Flight, bool> > >(), It.IsAny <Func <IQueryable <Flight>, IOrderedQueryable <Flight> > >(), It.IsAny <string>()), Times.Once); _distanceCalculatorMock.Verify(calculator => calculator.GetDistance(It.IsAny <Flight>())); _keroseneCalculatorMock.Verify(calculator => calculator.GetKeroseneQuantity(It.IsAny <Flight>(), It.IsAny <double>())); }