Пример #1
0
        public async Task <MatchWithContestants> Create(int warId, UserIdentifier userId)
        {
            var contestantCount = await _contestantRepository.GetCount(warId);

            var contestant1Index = _generateRandomNumber(0, contestantCount);
            var contestant2Index = GetContestant2Index(contestantCount, contestant1Index);

            var contestant1 = await _contestantRepository.Get(warId, contestant1Index);

            var contestant2 = await _contestantRepository.Get(warId, contestant2Index);

            Guid matchId = await CreateMatch(warId, contestant1, contestant2, userId);

            var result = new MatchWithContestants
            {
                Contestant1 = contestant1,
                Contestant2 = contestant2,
                Id          = matchId
            };

            return(result);
        }
Пример #2
0
 private void VerifyResult(MatchWithContestants result)
 {
     result.Id.Should().NotBeEmpty();
     result.Contestant1.Should().Be(_contestant1);
     result.Contestant2.Should().Be(_contestant2);
 }