예제 #1
0
        public async Task GetExperienceSummary_DoesNotThrow(string gamertag)
        {
            var query = new GetExperienceSummary(gamertag)
                        .SkipCache();

            var result = await Global.Session.Query(query);

            Assert.IsInstanceOf(typeof(ExperienceSummaryResultSet), result);
        }
예제 #2
0
        public async Task GetExperienceSummary_InvalidGamertag(string gamertag)
        {
            var query = new GetExperienceSummary(gamertag)
                        .SkipCache();

            await Global.Session.Query(query);

            Assert.Fail("An exception should have been thrown");
        }
예제 #3
0
        public async Task GetExperienceSummary_IsSerializable(string gamertag)
        {
            var query = new GetExperienceSummary(gamertag)
                        .SkipCache();

            var result = await Global.Session.Query(query);

            SerializationUtility <ExperienceSummaryResultSet> .AssertRoundTripSerializationIsPossible(result);
        }
예제 #4
0
        public async Task GetExperienceSummary_SchemaIsValid(string gamertag)
        {
            var jSchema = JSchema.Parse(File.ReadAllText(Schema), new JSchemaReaderSettings
            {
                Resolver = new JSchemaUrlResolver(),
                BaseUri  = new Uri(Path.GetFullPath(Schema))
            });

            var query = new GetExperienceSummary(gamertag)
                        .SkipCache();

            var jArray = await Global.Session.Get <JObject>(query.Uri);

            SchemaUtility.AssertSchemaIsValid(jSchema, jArray);
        }
예제 #5
0
        public async Task GetExperienceSummary_ModelMatchesSchema(string gamertag)
        {
            var schema = JSchema.Parse(File.ReadAllText(Schema), new JSchemaReaderSettings
            {
                Resolver = new JSchemaUrlResolver(),
                BaseUri  = new Uri(Path.GetFullPath(Schema))
            });

            var query = new GetExperienceSummary(gamertag)
                        .SkipCache();

            var result = await Global.Session.Query(query);

            var json       = JsonConvert.SerializeObject(result);
            var jContainer = JsonConvert.DeserializeObject <JObject>(json);

            SchemaUtility.AssertSchemaIsValid(schema, jContainer);
        }
예제 #6
0
        public void Uri_MatchesExpected(string player)
        {
            var query = new GetExperienceSummary(player);

            Assert.AreEqual($"https://www.haloapi.com/stats/hw2/xp?players={player}", query.Uri);
        }