Exemple #1
0
        public void Setup()
        {
            GamingInfo _gi = new GamingInfo()
            {
                GameId       = 1, GameTitle = "Halo", GameDescription = "Good Game", ReleaseDate = DateTime.Today,
                GamePlatform = 1, GameCategory = 1, GamePrice = 10
            };

            _dbContext.GamingInfo.Add(_gi);
            _dbContext.SaveChanges();

            BusinessGames _bg = new BusinessGames()
            {
                BusinessId = 1, GameId = 1
            };

            _dbContext.BusinessGames.Add(_bg);
            _dbContext.SaveChanges();

            GamingPlatform _pl = new GamingPlatform()
            {
                PlatformId = 1, PlatformName = "SNES"
            };

            _dbContext.GamingPlatform.Add(_pl);
            _dbContext.SaveChanges();

            GamingCategory _ca = new GamingCategory()
            {
                CategoryId = 1, CategoryName = "Puzzle"
            };

            _dbContext.GamingCategory.Add(_ca);
            _dbContext.SaveChanges();
        }
Exemple #2
0
        private static async Task ListFinishedCompetitionsFirstWinner(GamingPlatform gamingPlatform, string zipCode)
        {
            // Retrieve the winner with the first position for all the finished competitions
            // that allowed the platform received as an argument
            // and located in the zipCode received as an argument.
            var winnersQuery = client.CreateDocumentQuery <Competition>(collectionUri,
                                                                        new FeedOptions()
            {
                MaxItemCount = 100,
            })
                               .Where(c => (c.Location.ZipCode == zipCode) &&
                                      (c.Status == CompetitionStatus.Finished) &&
                                      (c.Platforms.Contains(gamingPlatform)))
                               .Select(c => c.Winners[0])
                               .AsDocumentQuery();

            while (winnersQuery.HasMoreResults)
            {
                var winnersQueryResult = await winnersQuery.ExecuteNextAsync <Winner>();

                foreach (var winner in winnersQueryResult)
                {
                    Console.WriteLine($"Nickname: {winner.Player.NickName}, Score: {winner.Score}");
                }
            }
        }
Exemple #3
0
        public void CheckPlatform_InsertId_ReturnName()
        {
            var controller = new GameController(_dbContext);

            string         platform = "SNES";
            GamingPlatform plat     = new GamingPlatform();

            plat.PlatformId = 1;

            string getName = controller.GetGamePlat(plat.PlatformId);

            Assert.AreEqual(getName, platform);
        }