public async Task GetBookingByAuditoryNumber_ReturnBooking() { //Arrange BookingAction ba = new BookingAction(); //Action var key = keyObjectService.GetByAuditoryName("132").Result; var collection = await bookingActionService.GetAll(x => x.KeyObjectId == key.Id && x.BookingFinish == null); //Assert Assert.IsTrue(collection.Count() > 0); }
/// <summary> /// Get info about not finished bookings /// </summary> /// <param name="numberOfAuditoryOfKeys"></param> /// <returns></returns> public async Task <DetailsView> GetCurrentInfoByKeyAuditory(string numberOfAuditoryOfKeys) { DetailsView model = null; if (numberOfAuditoryOfKeys != null && numberOfAuditoryOfKeys != "") { var currentKey = await _keyService.GetByAuditoryName(numberOfAuditoryOfKeys); var currentBooking = await _bookingAction.GetByRule(x => x.KeyObjectId == currentKey.Id && x.BookingFinish == null); var currentUser = await _userService.GetBy(currentBooking.UserId); model = new DetailsView() { KeyNumber = numberOfAuditoryOfKeys, FirstName = currentUser.FirstName, LastName = currentUser.LastName, DateTaking = currentBooking.BookingBegine }; return(model); } return(model); }