public void MultipleFaultyIds_ReturnsEmptyAccountCollection()
        {
            ulong[] ids = new ulong[] { 0, 0, 0 };

            var response = SteamApiClient.GetSteamAccountsAsync(ids)
                           .Result;

            SleepAfterSendingRequest();

            Assert.Empty(response.Contents);
        }
Пример #2
0
        /// <summary>
        /// Gets steam profile collection by sending
        /// http request to steam web api.
        /// </summary>
        /// <param name="id64s">collection of 64-bit steam ids</param>
        protected virtual IEnumerable <SteamProfileModel> GetSteamProfilesFromWebApi(CToken token,
                                                                                     params string[] id64s)
        {
            var apiResponse = _client.GetSteamAccountsAsync(token, id64s)
                              .Result;

            return(apiResponse.Select(x => new SteamProfileModel(x)
            {
                AvatarFullBytes = GetProfilePic(x.AvatarFullURL),
                AvatarMediumBytes = GetProfilePic(x.AvatarMediumURL),
                AvatarSmallBytes = GetProfilePic(x.AvatarURL)
            }));
        }
        public void MultipleIds_ReturnsAllRequestedProfiles(IEnumerable <ulong> id64s, int count)
        {
            var response = SteamApiClient.GetSteamAccountsAsync(id64s)
                           .Result;

            SleepAfterSendingRequest();

            Assert.True(response.Contents.Count == count);
            Assert.All(response.Contents, p =>
            {
                Assert.Contains(id64s, id => id == p.Id64);
                Assert.NotEmpty(p.AvatarMediumURL);
                Assert.NotEmpty(p.AvatarFullURL);
                Assert.NotEmpty(p.AvatarSmallURL);
            });
        }