public void Player_RecentProgress_NewPlayer()
        {
            var btag = new BattleTagIdCombined(new List <PlayerId>
            {
                PlayerId.Create("Peter#12")
            },
                                               GateWay.America,
                                               GameMode.GM_1v1,
                                               0);
            var gameModeStatPerGateway = PlayerGameModeStatPerGateway.Create(btag);

            gameModeStatPerGateway.RecordRanking(100, 180);
            gameModeStatPerGateway.RecordRanking(100, 230);

            Assert.AreEqual(50, gameModeStatPerGateway.RankingPointsProgress.RankingPoints);
        }
        public void Player_RecentProgress_DoubleUpdate_NegativeThenPositive()
        {
            var btag = new BattleTagIdCombined(new List <PlayerId>
            {
                PlayerId.Create("Peter#12")
            },
                                               GateWay.America,
                                               GameMode.GM_1v1,
                                               0);
            var gameModeStatPerGateway = PlayerGameModeStatPerGateway.Create(btag);

            gameModeStatPerGateway.RankProgressionStart = RankProgression.Create(0, 200);
            gameModeStatPerGateway.RecordRanking(100, 180);
            gameModeStatPerGateway.RecordRanking(100, 230);

            Assert.AreEqual(30, gameModeStatPerGateway.RankingPointsProgress.RankingPoints);
        }
        public void Player_RecentProgress_Mapping()
        {
            var btag = new BattleTagIdCombined(new List <PlayerId>
            {
                PlayerId.Create("Peter#12")
            },
                                               GateWay.America,
                                               GameMode.GM_1v1,
                                               0);
            var gameModeStatPerGateway = PlayerGameModeStatPerGateway.Create(btag);

            gameModeStatPerGateway.RankProgressionStart = RankProgression.Create(90, 200);
            gameModeStatPerGateway.RecordRanking(100, 220);

            Assert.AreEqual(20, gameModeStatPerGateway.RankingPointsProgress.RankingPoints);
            Assert.AreEqual(10, gameModeStatPerGateway.RankingPointsProgress.MMR);
        }
        public void Player_RecentProgress_After8Hours()
        {
            var btag = new BattleTagIdCombined(new List <PlayerId>
            {
                PlayerId.Create("Peter#12")
            },
                                               GateWay.America,
                                               GameMode.GM_1v1,
                                               0);
            var gameModeStatPerGateway = PlayerGameModeStatPerGateway.Create(btag);

            gameModeStatPerGateway.RankProgressionStart = RankProgression.Create(0, 200);
            gameModeStatPerGateway.RecordRanking(100, 180);
            gameModeStatPerGateway.RankProgressionStart.Date = DateTimeOffset.UtcNow.AddDays(-1);
            gameModeStatPerGateway.RecordRanking(100, 230);

            Assert.AreEqual(0, gameModeStatPerGateway.RankingPointsProgress.RankingPoints);
        }
예제 #5
0
        public async Task PlayerStatsMapping()
        {
            var playerRepository = new PlayerRepository(MongoClient);

            var battleTagIdCombined = new BattleTagIdCombined(new List <PlayerId>
            {
                PlayerId.Create("peter#123")
            },
                                                              GateWay.Europe,
                                                              GameMode.GM_1v1,
                                                              1);
            var player = PlayerGameModeStatPerGateway.Create(battleTagIdCombined);

            player.RecordRanking(234, 123);

            await playerRepository.UpsertPlayerGameModeStatPerGateway(player);

            var playerLoadedAgain = await playerRepository.LoadGameModeStatPerGateway("peter#123", GateWay.Europe, 1);

            Assert.AreEqual(234, playerLoadedAgain.Single().MMR);
            Assert.AreEqual(123, playerLoadedAgain.Single().RankingPoints);
        }
예제 #6
0
 public Task UpsertPlayerGameModeStatPerGateway(PlayerGameModeStatPerGateway stat)
 {
     return(Upsert(stat));
 }