public void LoanDbFilter_WhenGroupHasBills_ShouldReturnAllGroupLoans() { //Arrange var sutBuilder = new LoanDbFilterSutBuilder(); var loans = sutBuilder.Setup(); var filterInfo = new LoanFilterInfo { GroupId = loans[0].Bill.GroupContextId, }; var filter = new LoanDbFilter(filterInfo); var queryableLoans = loans.AsQueryable(); loans = loans.Where(u => u.Bill.GroupContextId == loans[0].Bill.GroupContextId).ToList(); //Act var result = filter.ApplyFilter(queryableLoans).ToList(); //Assert result.ShouldBe(loans); }
public void LoanDbFilter_WhenThereAreLoansCreatedBeforeCertainTime_ShouldReturnAllLoansCreatedBeforeThatTime() { //Arrange var sutBuilder = new LoanDbFilterSutBuilder(); var loans = sutBuilder.Setup(); var filterInfo = new LoanFilterInfo { EndTime = DateTime.Now.AddMilliseconds(1000), }; var filter = new LoanDbFilter(filterInfo); var queryableLoans = loans.AsQueryable(); loans = loans.Where(u => u.Bill.CreationTime < filterInfo.EndTime).ToList(); //Act var result = filter.ApplyFilter(queryableLoans).ToList(); //Assert result.ShouldBe(loans); }
public void LoanDbFilter_WhenLoaneeHasRecievedLoans_ShouldReturnOnlyReceivedLoans() { //Arrange var sutBuilder = new LoanDbFilterSutBuilder(); var loans = sutBuilder.Setup(); var filterInfo = new LoanFilterInfo { LoaneeId = loans[1].LoaneeId, }; var filter = new LoanDbFilter(filterInfo); var queryableLoans = loans.AsQueryable(); loans = loans.Where(u => u.LoaneeId == loans[1].LoaneeId).ToList(); //Act var result = filter.ApplyFilter(queryableLoans).ToList(); //Assert result.ShouldBe(loans); }