Example #1
0
        public static void ShowSearchPlayersSample()
        {
            // we initialize the WGApplication object by calling the most basic constructor which needs you to supply your application id
            IWGApplication wgApplication = new WGApplication(applicationId);

            // The response will be of the WGResponse<T> where T is the type that you will get

            // e.g. calling the SearchPlayers method will return a WGResponse<List<Player>>

            var playersQueryResult = wgApplication.SearchPlayers("Just0rz");

            if (playersQueryResult.Status != "ok")
            {
                Console.WriteLine("There was an error when trying to retrieve the items");

                return;
            }

            if (playersQueryResult.Count <= 0)
            {
                Console.WriteLine("Query yielded no results.");

                return;
            }

            foreach (var player in playersQueryResult.Data)
            {
                Console.WriteLine("AccountID: {0}, Nickname: {1}", player.AccountId, player.Nickname);
            }

            Console.ReadKey();
        }
Example #2
0
        public void Account_list_return_1_valid_user_using_a_specific_searchType_and_result_limit()
        {
            var result = WGApplication.SearchPlayers("Just0rz", WGSharpAPI.Enums.WGSearchType.Exact, 1);

            Assert.IsNotNull(result.Data);
            Assert.AreEqual("ok", result.Status);
            Assert.AreEqual(accountId, result.Data[0].AccountId);
            Assert.AreEqual("Just0rz", result.Data[0].Nickname);
        }
Example #3
0
        public void Account_list_return_1_valid_user_with_specified_responseFields()
        {
            var result = WGApplication.SearchPlayers("Just0rz", "account_id", WGSharpAPI.Enums.WGLanguageField.EN, WGSharpAPI.Enums.WGSearchType.Exact, 1);

            Assert.IsNotNull(result.Data);
            Assert.AreEqual(result.Status, "ok");
            Assert.AreEqual(result.Data[0].AccountId, accountId);
            Assert.IsNull(result.Data[0].Nickname);
        }
Example #4
0
        public void Account_list_return_1_valid_user()
        {
            var result = WGApplication.SearchPlayers("Just0rz");

            Assert.IsNotNull(result.Data);
            Assert.AreEqual("ok", result.Status);
            Assert.AreEqual(accountId, result.Data[0].AccountId);
            Assert.AreEqual("Just0rz", result.Data[0].Nickname);
        }
Example #5
0
        public void Account_list_search_less_than_3_chars_startswith()
        {
            var expectedResult = new WGResponse <List <Player> > {
                Status = "error",
            };

            var result = WGApplication.SearchPlayers("Ju");

            Assert.AreEqual(expectedResult.Status, result.Status);
            Assert.IsNull(result.Data);
        }