Esempio n. 1
0
        public async Task UpdateOverview_HandlerUpdate_2v2RT()
        {
            var matchFinishedEvent  = TestDtoHelper.CreateFake2v2RTEvent();
            var playerRepository    = new PlayerRepository(MongoClient);
            var playOverviewHandler = new PlayOverviewHandler(playerRepository);

            await playOverviewHandler.Update(matchFinishedEvent);

            var winners = matchFinishedEvent.match.players.Where(x => x.won);

            Assert.AreEqual(2, winners.Count());

            foreach (var player in winners)
            {
                var playerProfile = await playerRepository.LoadOverview($"0_{player.battleTag}@20_GM_2v2");

                Assert.AreEqual(1, playerProfile.Wins);
                Assert.AreEqual(0, playerProfile.Losses);
                Assert.AreEqual(GameMode.GM_2v2, playerProfile.GameMode);
            }

            var losers = matchFinishedEvent.match.players.Where(x => !x.won);

            Assert.AreEqual(2, losers.Count());

            foreach (var player in losers)
            {
                var playerProfile = await playerRepository.LoadOverview($"0_{player.battleTag}@20_GM_2v2");

                Assert.AreEqual(0, playerProfile.Wins);
                Assert.AreEqual(1, playerProfile.Losses);
                Assert.AreEqual(GameMode.GM_2v2, playerProfile.GameMode);
            }
        }