public void GetMatchHistory_ValidRequest_MapsResponseCorrectly()
        {
            _httpClientMock.Setup(client => client.SendRequest(It.IsAny <string>()))
            .Returns(MatchHistoryServiceMockData.GenericSuccess);

            var service = new MatchHistoryService(_httpClientMock.Object, MockApiKey);
            var result  = service.GetMatchHistory(accountId: MockAccountId, matchesRequested: 1).Result;

            Assert.AreEqual(result.NumResults, 1);
            Assert.AreEqual(result.Status, 1);
            Assert.IsNull(result.StatusDetail);
            Assert.AreEqual(result.TotalResults, 500);
            Assert.AreEqual(result.ResultsRemaining, result.TotalResults - result.NumResults);
            Assert.IsNotNull(result.Matches);
            Assert.AreEqual(result.Matches.Count, 1);

            var match = result.Matches.FirstOrDefault();

            Assert.AreEqual(match.MatchId, 3088091200);
            Assert.AreEqual(match.MatchSequenceNumber, 2696663841);
            Assert.AreEqual(match.StartTime, SharedFunctions.UnixTimeStampToDateTime(1490921858));

            var players = match.Players;

            Assert.AreEqual(players.Count, 10);
            Assert.IsTrue(players.Any(x => x.AccountId == MockAccountId));

            foreach (var player in players)
            {
                Assert.IsNotNull(player.AccountId);
                Assert.IsNotNull(player.PlayerSlot);
                Assert.IsNotNull(player.HeroId);
            }
        }
        public void GetMatchHistory_InvalidAccountId_MapsErrorResponse()
        {
            _httpClientMock.Setup(client => client.SendRequest(It.IsAny <string>()))
            .Returns(MatchHistoryServiceMockData.NotFound);

            var service = new MatchHistoryService(_httpClientMock.Object, MockApiKey);
            var result  = service.GetMatchHistory(MockAccountId).Result;

            Assert.AreEqual(result.Status, 15);
            Assert.IsNotNull(result.StatusDetail);
            Assert.IsNull(result.Matches);
            Assert.AreEqual(result.NumResults, 0);
            Assert.AreEqual(result.ResultsRemaining, 0);
            Assert.AreEqual(result.TotalResults, 0);
        }
Beispiel #3
0
        public Session()
        {
            AccountService        = new Riot.Services.AccountService(this);
            ChampionTradeService  = new Riot.Services.ChampionTradeService(this);
            ClientFacadeService   = new Riot.Services.ClientFacadeService(this);
            GameInvitationService = new Riot.Services.GameInvitationService(this);
            GameService           = new Riot.Services.GameService(this);
            InventoryService      = new Riot.Services.InventoryService(this);
            LcdsProxyService      = new Riot.Services.LcdsProxyService(this);
            LeaguesService        = new Riot.Services.LeaguesService(this);
            LoginService          = new Riot.Services.LoginService(this);
            MasteryBookService    = new Riot.Services.MasteryBookService(this);
            MatchmakingService    = new Riot.Services.MatchmakingService(this);
            PlayerStatsService    = new Riot.Services.PlayerStatsService(this);
            RerollService         = new Riot.Services.RerollService(this);
            SpellBookService      = new Riot.Services.SpellBookService(this);
            SummonerIconService   = new Riot.Services.SummonerIconService(this);
            SummonerRuneService   = new Riot.Services.SummonerRuneService(this);
            SummonerService       = new Riot.Services.SummonerService(this);
            SummonerTeamService   = new Riot.Services.SummonerTeamService(this);

            LootService             = new LootService(this, LcdsProxyService);
            ChampionMasteryService  = new ChampionMasteryService(this, LcdsProxyService);
            TeambuilderDraftService = new TeambuilderDraftService(this, LcdsProxyService);

            PlayerPreferencesService = new PlayerPreferencesService(this);
            MatchHistoryService      = new MatchHistoryService(this);

            var patcher = new PatcherService(this);

            this.chat = new ChatService(this);

            this.Maestro = new Maestro(chat, patcher);

            var settings = new SettingsService(this);

            var hextech   = new HextechService(this);
            var champions = new ChampionsService(this);
            var masteries = new MasteriesService(this);
            var runes     = new RunesService(this);

            var matches = new Server.Profile.MatchHistoryService(this);

            this.summoner = new SummonerService(this);
            this.Assets   = new AssetsService(patcher);

            var rooms = new ChatRoomService(this, chat);
            var login = new AuthService(this);

            var game   = new PlayLoopService(this, rooms);
            var invite = new InviteService(this, game);

            var meta  = new MetaService(this);
            var debug = new DebugService(this);

            var replay = new ReplayService(this);

            patcher.FinishWAD();

            var info = new InfoService(this, patcher);
        }