public async Task GetLodgmentsAsync_ThereAreLodgments_ShouldReturnThePaginatedLodgments() { // Arrange paging = new PagingModel(); paging.Order = "Id"; expectedLodgment.IsActive = true; expectedLodgment.IsDeleted = false; context.Add(expectedLodgment); await context.SaveChangesAsync(); //Act var actualPaginatedLodgments = await repository.GetLodgmentsAsync(paging); //Assert Assert.AreEqual(expectedLodgment, actualPaginatedLodgments.Data.First()); }
public async Task <PaginatedModel <Lodgment> > GetLodgmentsAsync(PagingModel pagingModel, LodgmentOptionsModel?lodgmentOptionsModel = null, int?spotId = null, bool?includeDeactivated = false) { var paginatedLodgments = await repository.GetLodgmentsAsync(pagingModel, spotId, includeDeactivated); foreach (var lodgment in paginatedLodgments.Data) { lodgment.TotalPrice = await lodgmentCalculator.CalculateTotalStayAsync(lodgmentOptionsModel, lodgment); } return(paginatedLodgments); }