public async Task Should_GetTotalAvailablePlaces() { // Arrange var LHandleTotalAvailablePlaces = new GetTotalAvailablePlacesQueryHandler(FMainDbContext); var LRequest = new GetTotalAvailablePlacesQuery(); // Act var LResult = await LHandleTotalAvailablePlaces.Handle(LRequest, CancellationToken.None); // Assert LResult.Number.Should().Be(3); }
public int Handle(GetTotalAvailablePlacesQuery _) { return(_dbContext.Set <ParkingPlace>() .Where(p => p.Parking.IsOpened && p.IsFree) .Count()); }
public int GetTotalAvailablePlaces() { var query = new GetTotalAvailablePlacesQuery(); return(_queryHandler.Handle(query)); }