예제 #1
0
 void AddGame(Data.PingPongContext context, Guid player1, Guid player2, Byte player1Score, Byte player2Score, Guid winner)
 {
     context.Games.Add(new Data.Game()
     {
         Id              = Guid.NewGuid(),
         Player1Id       = player1,
         Player2Id       = player2,
         WinningPlayerId = winner,
         PlayedOn        = DateTime.Now, Player1Score = player1Score, Player2Score = player2Score
     });
 }
        public void Initialise()
        {
            var options = new DbContextOptionsBuilder <Data.PingPongContext>().UseInMemoryDatabase(databaseName: "PingPong" + Guid.NewGuid().ToString()).Options;

            Context = new Data.PingPongContext(options);

            //populate some players
            var player1 = new Data.Player()
            {
                Id = Guid.NewGuid(), FirstName = "Test1Firstname", LastName = "Test1Lastname"
            };
            var player2 = new Data.Player()
            {
                Id = Guid.NewGuid(), FirstName = "Test2Firstname", LastName = "Test2Lastname"
            };
            var player3 = new Data.Player()
            {
                Id = Guid.NewGuid(), FirstName = "Test3Firstname", LastName = "Test3Lastname"
            };
            var player4 = new Data.Player()
            {
                Id = Guid.NewGuid(), FirstName = "Test4Firstname", LastName = "Test4Lastname"
            };
            var player5 = new Data.Player()
            {
                Id = Guid.NewGuid(), FirstName = "Test5Firstname", LastName = "Test5Lastname"
            };
            var player6 = new Data.Player()
            {
                Id = Guid.NewGuid(), FirstName = "Test6Firstname", LastName = "Test6Lastname"
            };

            Context.Players.Add(player1);
            Context.Players.Add(player2);
            Context.Players.Add(player3);
            Context.Players.Add(player4);
            Context.Players.Add(player5);
            Context.Players.Add(player6);

            Context.SaveChanges();

            PlayersService = new Business.Services.Players(Context);
        }
예제 #3
0
 public Ranking(Data.PingPongContext context)
 {
     Context = context;
 }
예제 #4
0
 public Games(Data.PingPongContext context)
 {
     this.Context = context;
 }
예제 #5
0
 public PlayerRanker(Data.PingPongContext context)
 {
     Context = context;
 }
예제 #6
0
 public RankingJobs(Data.PingPongContext context, RankingJobRunner jobRunner)
 {
     Context   = context;
     JobRunner = jobRunner;
 }
예제 #7
0
 public Players(Data.PingPongContext context)
 {
     this.Context = context;
 }