Esempio n. 1
0
        public static void Main(string[] args)
        {
            //Create new instance of DotaCore object using API key
            DotaCore lib = new DotaCore(ApiKey);

            //DotaCore.GetMatchHistory fetches match history of a specific accountid
            MatchHistoryResult matchHistory = lib.GetMatchHistory(accountId: 32588391, matchesRequested: 1);

            Debug.Assert(matchHistory != null);
            Debug.Assert(matchHistory.Matches.Count == 1);

            //DotaCore.GetMatchDetails gets detailed information about a specific matchid
            MatchDetailsResult matchDetails1 = lib.GetMatchDetails(3053641442); // Recent tournament match
            MatchDetailsResult matchDetails2 = lib.GetMatchDetails(501672851);  // Old wraith night game

            Debug.Assert(matchDetails1 != null);
            Debug.Assert(matchDetails1.RadiantWin == true);
            Debug.Assert(matchDetails2 != null);
            Debug.Assert(matchDetails2.RadiantWin == false);

            //DotaCore.GetHeroDetails fetches all heroes in the API with hero names localized to en_uk (en_us default)
            HeroDetailsResult heroDetails = lib.GetAllHeroDetails("en_uk");

            Debug.Assert(heroDetails.Status == (int)HttpStatusCode.OK);

            //DotaCore.GetItemDetails fetches all items in the API with item names localized to en_uk (en_us default)
            ItemDetailsResult itemDetails = lib.GetAllItemDetails("en_uk");

            Debug.Assert(itemDetails.Status == (int)HttpStatusCode.OK);

            Console.WriteLine("All POC tests have passed. Press any key to continue");
            Console.ReadKey();
        }
        public void GetItemDetails_Valid()
        {
            MockClient.Setup(s => s.SendRequest(It.IsAny <string>())).Returns(ItemDetailsServiceMockData.ItemDetails);
            IItemDetailsService Service = new ItemDetailsService(MockClient.Object, MockApiKey);
            ItemDetailsResult   result  = Service.GetItemDetails("en-us").Result;

            Assert.AreEqual(result.Status, 200);
            Assert.IsNotNull(result.Items);
        }