コード例 #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);
        }