public async Task <ResponseDTO> Approve(AmigoTenantTServiceApproveRequest search) { return(await _serviceApplicationService.ApproveAmigoTenantTServiceAsync(search)); }
public async Task ApproveAmigoTenantTServiceAsync_Calculate_By_Hour() { //Arrange IEnumerable <AmigoTenantTServiceApproveRateDTO> rates = new List <AmigoTenantTServiceApproveRateDTO>() { new AmigoTenantTServiceApproveRateDTO() { RateId = 99, AmigoTenantTServiceId = "1", PayDriver = 10, BillCustomer = 100, TotalHours = 1, IsPerHour = 1, PayBy = Constants.RowStatusString.Active }, new AmigoTenantTServiceApproveRateDTO() { RateId = 99, AmigoTenantTServiceId = "2", BillCustomer = 100, TotalHours = 1, PayDriver = 10, IsPerHour = 1, PayBy = Constants.RowStatusString.Active } }; A.CallTo(() => _repoApproveRate.ListAsync(null, null, null)).WithAnyArguments().ReturnsLazily((c) => Task.FromResult(rates)); var request = new AmigoTenantTServiceApproveRequest() { ApprovedBy = "FMORON", UserId = 1, ReportDate = DateTime.Now, AmigoTenantTServiceIdsListStatus = new List <AmigoTenantTServiceStatus>() { new AmigoTenantTServiceStatus() { AmigoTenantTServiceId = "1", ServiceStatus = true }, new AmigoTenantTServiceStatus() { AmigoTenantTServiceId = "2", ServiceStatus = true } } }; RegisterDriverReportCommand commandResult = null; A.CallTo(() => _bus.SendAsync(new RegisterDriverReportCommand())).WithAnyArguments().ReturnsLazily( (o) => { commandResult = o.Arguments.FirstOrDefault() as RegisterDriverReportCommand; return(Task.FromResult(new CommandResult(new List <string>()))); }); //Act var resp = await _appService.ApproveAmigoTenantTServiceAsync(request); //Assert Assert.True(resp.IsValid); Assert.NotNull(commandResult); Assert.AreEqual(commandResult.DayBillCustomerTotal, 200); }