コード例 #1
0
        public void CanCreateMatch()
        {
            //Arrange
            var p1Id = Guid.NewGuid();
            var p2Id = Guid.NewGuid();

            //Act
            var match = MatchFactory.Create(p1Id, p2Id);

            //Assert
            Assert.Equal(p1Id, match.PlayerOneId);
        }
コード例 #2
0
        public List <Match> GenerateMatches(Guid competitionId)
        {
            var compPlayers = ListPlayers(competitionId);

            if (compPlayers.Count % 2 != 0)
            {
                return(null);
            }
            for (var i = 0; i < compPlayers.Count; i += 2)
            {
                //if (i % 2 != 0) continue;
                var playerOne = compPlayers[i];
                var playerTwo = compPlayers[i + 1];

                var match = MatchFactory.Create(playerOne.PartyId, playerTwo.PartyId);

                _context.Add(match);
                _context.SaveChanges();
            }
            return(_context.Competitions.FirstOrDefault(x => x.CompetitionId == competitionId).Matches);
        }
コード例 #3
0
ファイル: Create.cs プロジェクト: ceresnik/CodingArena
 public override void SetUp()
 {
     base.SetUp();
     Match = MatchFactory.Create();
 }