Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
 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());
        }
Exemplo n.º 4
0
 public Realm(RealmJson realmJson) : this()
 {
     Load(realmJson);
 }
 public BlizzardApiReaderGetRealmTests(BlizzardApiReaderTests blizzardApiReaderTests)
 {
     BlizzardApiReaderTests = blizzardApiReaderTests;
     ExpectedJson           = WoWJsonGenerator.RandomRealmJson();
 }
Exemplo n.º 6
0
        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);
        }