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); }
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"); }
public async Task GetExperienceSummary_IsSerializable(string gamertag) { var query = new GetExperienceSummary(gamertag) .SkipCache(); var result = await Global.Session.Query(query); SerializationUtility <ExperienceSummaryResultSet> .AssertRoundTripSerializationIsPossible(result); }
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); }
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); }
public void Uri_MatchesExpected(string player) { var query = new GetExperienceSummary(player); Assert.AreEqual($"https://www.haloapi.com/stats/hw2/xp?players={player}", query.Uri); }