Beispiel #1
0
        public Task <GoldPassSeason> GetCurrentGoldPassSeasonAsync()
        {
            var request = new AutoValidatedRequest
            {
                Uri = $"/goldpass/seasons/current"
            };

            return(_gameData.RequestAsync <GoldPassSeason>(request));
        }
Beispiel #2
0
        public Task <WarLeague> GetWarLeagueAsync(int?leagueId)
        {
            var request = new AutoValidatedRequest
            {
                LeagueId = leagueId,
                Uri      = $"/warleagues/{leagueId}"
            };

            return(_gameData.RequestAsync <WarLeague>(request));
        }
Beispiel #3
0
        public Task <QueryResult <ClanList> > SearchClansAsync(QueryClans query)
        {
            var request = new AutoValidatedRequest
            {
                QueryClans = query,
                Uri        = "/clans"
            };

            return(_gameData.QueryAsync <ClanList>(request));
        }
Beispiel #4
0
        public Task <Player> GetPlayerAsync(string playerTag)
        {
            var request = new AutoValidatedRequest
            {
                PlayerTag = playerTag,
                Uri       = $"/players/{playerTag}"
            };

            return(_gameData.RequestAsync <Player>(request));
        }
Beispiel #5
0
        public Task <Clan> GetClanAsync(string clanTag)
        {
            var request = new AutoValidatedRequest
            {
                ClanTag = clanTag,
                Uri     = $"/clans/{clanTag}"
            };

            return(_gameData.RequestAsync <Clan>(request));
        }
Beispiel #6
0
        public Task <ClanWar> GetCurrentWarAsync(string clanTag)
        {
            var request = new AutoValidatedRequest
            {
                ClanTag = clanTag,
                Uri     = $"/clans/{clanTag}/currentwar"
            };

            return(_gameData.RequestAsync <ClanWar>(request));
        }
Beispiel #7
0
        public Task <Location> GetLocationAsync(int?locationId)
        {
            var request = new AutoValidatedRequest
            {
                LocationId = locationId,
                Uri        = $"/locations/{locationId}"
            };

            return(_gameData.RequestAsync <Location>(request));
        }
Beispiel #8
0
        public Task <QueryResult <LocationList> > GetLocationsAsync(Query?query = default)
        {
            var request = new AutoValidatedRequest
            {
                Query = query,
                Uri   = "/locations"
            };

            return(_gameData.QueryAsync <LocationList>(request));
        }
Beispiel #9
0
        public Task <QueryResult <LabelList> > GetPlayerLabelsAsync(Query?query = default)
        {
            var request = new AutoValidatedRequest
            {
                Query = query,
                Uri   = "/labels/players"
            };

            return(_gameData.QueryAsync <LabelList>(request));
        }
Beispiel #10
0
        public Task <ClanWarLeagueWar> GetClanWarLeagueWarAsync(string warTag)
        {
            var request = new AutoValidatedRequest
            {
                WarTag = warTag,
                Uri    = $"/clanwarleagues/wars/{warTag}"
            };

            return(_gameData.RequestAsync <ClanWarLeagueWar>(request));
        }
Beispiel #11
0
        public Task <ClanWarLeagueGroup> GetClanWarLeagueGroupAsync(string clanTag)
        {
            var request = new AutoValidatedRequest
            {
                ClanTag = clanTag,
                Uri     = $"/clans/{clanTag}/currentwar/leaguegroup"
            };

            return(_gameData.RequestAsync <ClanWarLeagueGroup>(request));
        }
Beispiel #12
0
        public Task <QueryResult <WarLeagueList> > GetWarLeaguesAsync(Query?query = default)
        {
            var request = new AutoValidatedRequest
            {
                Query = query,
                Uri   = $"/warleagues"
            };

            return(_gameData.QueryAsync <WarLeagueList>(request));
        }
Beispiel #13
0
        public Task <QueryResult <LeagueSeasonList> > GetLeagueSeasonsAsync(int?leagueId, Query?query = default)
        {
            var request = new AutoValidatedRequest
            {
                Query    = query,
                LeagueId = leagueId,
                Uri      = $"/leagues/{leagueId}/seasons"
            };

            return(_gameData.QueryAsync <LeagueSeasonList>(request));
        }
Beispiel #14
0
        public Task <QueryResult <ClanMemberList> > GetClanMembersAsync(string clanTag, Query?query = default)
        {
            var request = new AutoValidatedRequest
            {
                Query   = query,
                ClanTag = clanTag,
                Uri     = $"/clans/{clanTag}/members"
            };

            return(_gameData.QueryAsync <ClanMemberList>(request));
        }
Beispiel #15
0
        public Task <QueryResult <PlayerVersusRankingList> > GetPlayerVersusRankingAsync(int?locationId, Query?query = default)
        {
            var request = new AutoValidatedRequest
            {
                Query      = query,
                LocationId = locationId,
                Uri        = $"/locations/{locationId}/rankings/players-versus"
            };

            return(_gameData.QueryAsync <PlayerVersusRankingList>(request));
        }
Beispiel #16
0
        public Task <QueryResult <ClanWarLog> > GetClanWarLogAsync(string clanTag, Query?query = default)
        {
            var request = new AutoValidatedRequest
            {
                Query   = query,
                ClanTag = clanTag,
                Uri     = $"/clans/{clanTag}/warlog"
            };

            return(_gameData.QueryAsync <ClanWarLog>(request));
        }
Beispiel #17
0
        public Task <QueryResult <PlayerRankingList> > GetLeagueSeasonRankingsAsync(int?leagueId, string seasonId, Query?query = default)
        {
            var request = new AutoValidatedRequest
            {
                Query    = query,
                LeagueId = leagueId,
                SeasonId = seasonId,
                Uri      = $"/leagues/{leagueId}/seasons/{seasonId}"
            };

            return(_gameData.QueryAsync <PlayerRankingList>(request));
        }
Beispiel #18
0
        public void EachRequestHasUniqueCorrelationId()
        {
            // Arrange
            var req1 = new AutoValidatedRequest();
            var req2 = new AutoValidatedRequest();

            // Act

            // Assert
            Assert.IsNotNull(req1.CorrelationId);
            Assert.IsNotNull(req2.CorrelationId);
            Assert.AreNotEqual(req1.CorrelationId, req2.CorrelationId);
        }
Beispiel #19
0
        public Task <VerifyTokenResponse> VerifyTokenAsync(string playerTag, string playerApiToken)
        {
            var request = new AutoValidatedRequest
            {
                PlayerTag = playerTag,
                Uri       = $"/players/{playerTag}/verifytoken",
                Content   = new VerifyTokenRequest
                {
                    Token = playerApiToken
                }
            };

            return(_gameData.RequestAsync <VerifyTokenResponse>(request));
        }
Beispiel #20
0
        public void SetEmptyPlayerTagThrows()
        {
            // Arrange
            var request = new AutoValidatedRequest();

            try
            {
                // Act
                request.PlayerTag = "";

                // Assert
                Assert.Fail();
            }
            catch (ArgumentException ex)
            {
                Trace.WriteLine(ex);
            }
        }
Beispiel #21
0
        public void SetEmptyLocationIdentifierThrows()
        {
            // Arrange
            var request = new AutoValidatedRequest();

            try
            {
                // Act
                request.LocationId = null;

                // Assert
                Assert.Fail();
            }
            catch (ArgumentException ex)
            {
                Trace.WriteLine(ex);
            }
        }
Beispiel #22
0
        public void SetInvalidWarTagThrows()
        {
            // Arrange
            var request = new AutoValidatedRequest();

            try
            {
                // Act
                request.WarTag = Constants.InvalidWarTag;

                // Assert
                Assert.Fail();
            }
            catch (ArgumentException ex)
            {
                Trace.WriteLine(ex);
            }
        }
Beispiel #23
0
        public void GetUninitializedUriThrows()
        {
            // Arrange
            var request = new AutoValidatedRequest();

            // Act
            try
            {
                var uri = request.Uri;

                // Assert
                Assert.Fail($"Uri has a value '{uri}'");
            }
            catch (InvalidOperationException ex)
            {
                Trace.WriteLine(ex);
            }
        }
Beispiel #24
0
        public void SetEmptyQueryThrows()
        {
            // Arrange
            var request = new AutoValidatedRequest();

            try
            {
                // Act
                request.QueryClans = null;

                // Assert
                Assert.Fail();
            }
            catch (ArgumentException ex)
            {
                Trace.WriteLine(ex);
            }
        }
Beispiel #25
0
        public void SetQueryWithBeforeSpecified()
        {
            // Arrange
            var request = new AutoValidatedRequest();
            var query   = new Query
            {
                Before = "Before"
            };

            try
            {
                // Act
                request.Query = query;
            }
            catch (Exception)
            {
                // Assert
                Assert.Fail();
            }
        }
Beispiel #26
0
        public void SetThreeCharactersLongName()
        {
            // Arrange
            var request = new AutoValidatedRequest();
            var query   = new QueryClans
            {
                Name = "abc"
            };

            try
            {
                // Act
                request.QueryClans = query;
            }
            catch (Exception)
            {
                // Assert
                Assert.Fail();
            }
        }
Beispiel #27
0
        public void InvalidPlayerTagStartCharacterThrows()
        {
            // Arrange
            var request = new AutoValidatedRequest();

            foreach (var playerTag in PlayerTags)
            {
                try
                {
                    // Act
                    request.PlayerTag = playerTag.Substring(1);

                    // Assert
                    Assert.Fail();
                }
                catch (ArgumentException ex)
                {
                    Trace.WriteLine(ex);
                }
            }
        }
Beispiel #28
0
        public void PlayerTagsFromConfigFileAreValid()
        {
            // Arrange
            var request = new AutoValidatedRequest();

            foreach (var playerTag in PlayerTags)
            {
                try
                {
                    // Act
                    request.PlayerTag = playerTag;
                }
                catch (ArgumentException ex)
                {
                    // Assert
                    Assert.Fail();

                    Trace.WriteLine(ex);
                }
            }
        }
Beispiel #29
0
        public void SetMultipleLabelIdsWithInvalidSeparatorThrows()
        {
            // Arrange
            var request = new AutoValidatedRequest();
            var query   = new QueryClans
            {
                LabelIds = "56000000, 56000001, 56000002"
            };

            try
            {
                // Act
                request.QueryClans = query;

                // Assert
                Assert.Fail();
            }
            catch (ArgumentException ex)
            {
                Trace.WriteLine(ex);
            }
        }
Beispiel #30
0
        public void SetValidLabelIds()
        {
            // Arrange
            var request = new AutoValidatedRequest();
            var query   = new QueryClans
            {
                LabelIds = "56000000"
            };

            try
            {
                // Act
                request.QueryClans = query;
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex);

                // Assert
                Assert.Fail();
            }
        }