Beispiel #1
0
        public async Task FindParticipantMatchesAsync_ShouldBeEquivalentToParticipantMatchList(Game game, ChallengeState state)
        {
            //Arrange
            var challengeFaker = TestData.FakerFactory.CreateChallengeFaker(89568322, game, state);

            var challenge = challengeFaker.FakeChallenge();

            using var factory = new InMemoryDbContextFactory <ChallengesDbContext>();

            await using (var context = factory.CreateContext())
            {
                var challengeRepository = new ChallengeRepository(context);

                challengeRepository.Create(challenge);

                await challengeRepository.CommitAsync();
            }

            await using (var context = factory.CreateContext())
            {
                var matchQuery = new MatchQuery(context);

                foreach (var participant in challenge.Participants)
                {
                    //Act
                    var matches = await matchQuery.FetchParticipantMatchesAsync(ParticipantId.FromGuid(participant.Id));

                    //Arrange
                    matches.Should().BeEquivalentTo(participant.Matches.ToList());
                }
            }
        }