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);
        }
        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);
        }
Exemple #3
0
 public override void SetUp()
 {
     base.SetUp();
     Match = MatchFactory.Create();
 }