public async Task GetRealm_Test() { string realmSlug = "hyjal"; string query = $"data/wow/realm/{realmSlug}"; RealmJson result = await Api.GetAsync <RealmJson>(query, Namespace.Dynamic).ConfigureAwait(false); Assert.Equal(HttpStatusCode.OK, result.ResultCode); Assert.True(result.DirectlyCalled); Assert.Equal(realmSlug, result.Slug); }
public void Load(RealmJson realmJson) { if (CheckJson(realmJson)) { BlizzardId = realmJson.Id; Name = realmJson.Name; Slug = realmJson.Slug; Category = realmJson.Category; Locale = realmJson.Locale; Timezone = realmJson.Timezone; Tournament = realmJson.Tournament; Type = realmJson.Type?.Name; } }
public async Task GetJson_Valid() { WebClientMocker webClient = new WebClientMocker(); webClient.SetupAuth(true); webClient.SetupApiRequest(It.IsAny <string>(), HttpStatusCode.OK, JsonSerializer.Serialize(ExpectedJson)); BlizzardApiReader api = new BlizzardApiReader(BlizzardApiReaderTests.DefaultConfiguration, webClient.WebClient); RealmJson jsonResult = await api.GetAsync <RealmJson>("test", Namespace.Static).ConfigureAwait(false); Assert.True(ExpectedJson.IsClone(jsonResult)); webClient.VerifyAuth(Times.Once()); webClient.VerifyApiRequest(It.IsAny <string>(), Times.Once()); }
public Realm(RealmJson realmJson) : this() { Load(realmJson); }
public BlizzardApiReaderGetRealmTests(BlizzardApiReaderTests blizzardApiReaderTests) { BlizzardApiReaderTests = blizzardApiReaderTests; ExpectedJson = WoWJsonGenerator.RandomRealmJson(); }
private async Task FillRealm(string realmSlug) { RealmJson realmJson = await _blizzardApiReader.GetAsync <RealmJson>($"data/wow/realm/{realmSlug}", Namespace.Dynamic).ConfigureAwait(false); await _dbManager.Insert(new Realm(realmJson)).ConfigureAwait(false); }