Example #1
0
        public async Task AreAllCompletedForBoardGameAsync_Should_ReturnFalse_When_ThereIsAnInProgressRental()
        {
            var boardGameId = Guid.NewGuid();
            var rentals     = new List <Persistence.Entities.Rental>
            {
                new Persistence.Entities.Rental
                {
                    BoardGameId = boardGameId,
                    Status      = Status.InProgress
                },
                new Persistence.Entities.Rental
                {
                    BoardGameId = boardGameId,
                    Status      = Status.Completed
                }
            };
            await _testContext.Rentals.AddRangeAsync(rentals, _cancellationToken);

            await _testContext.SaveChangesAsync(_cancellationToken);

            var response =
                await _sut.RentalRepository.AreAllCompletedForBoardGameAsync(boardGameId, _cancellationToken);

            response.Should().BeFalse();
        }
        public async Task GetAllAsync_Should_ReturnMappedListOfGameBoards_When_SomeExist()
        {
            var entity1 = new Persistence.Entities.BoardGame
            {
                Id = Guid.NewGuid()
            };
            var entity2 = new Persistence.Entities.BoardGame
            {
                Id = Guid.NewGuid()
            };
            var entities = new List <Persistence.Entities.BoardGame> {
                entity1, entity2
            };
            await _testContext.BoardGames.AddRangeAsync(entities, _cancellationToken);

            await _testContext.SaveChangesAsync(_cancellationToken);

            var result = await _sut.BoardGameRepository.GetAllAsync(_cancellationToken);

            result.Should().Contain(x => x.Id == entity1.Id);
            result.Should().Contain(x => x.Id == entity2.Id);
        }
Example #3
0
 public async Task SaveChangesAsync(CancellationToken cancellationToken)
 {
     await _playingoContext.SaveChangesAsync(cancellationToken);
 }