public IQueryable <Lounge> GetAvailableLounges(Session session) { IQueryable <Session> futureSessions = GetAll().Where(x => x.Start > DateTime.Now); var occupiedLounges = futureSessions.Where(CrossSchedule(session)).Select(futureSession => futureSession.Lounge.Id); var availableLounges = _loungeService.GetAll().Where(x => !occupiedLounges.Contains(x.Id)); return(availableLounges); }
public void Lounge_Service_Should_Get_All_Lounges_Sucessfully() { //Arrange var lounge = ObjectMother.GetDefaultLounge(); var mockValueRepository = new List <Lounge>() { lounge }.AsQueryable(); _mockLoungeRepository.Setup(r => r.GetAll()).Returns(mockValueRepository); //Action var lounges = _loungeService.GetAll(); //Assert _mockLoungeRepository.Verify(r => r.GetAll(), Times.Once); lounges.Should().NotBeNull(); lounges.First().Should().Be(lounge); lounges.Count().Should().Be(mockValueRepository.Count()); }
public IHttpActionResult Get(ODataQueryOptions <Lounge> queryOptions) { return(HandleQueryable <Lounge, LoungeViewModel>(_service.GetAll(), queryOptions)); }