public async Task GetCampaignLevels_DoesNotThrow() { var query = new HaloSharp.Query.HaloWars2.Metadata.GetCampaignLevels() .SkipCache(); var result = await Global.Session.Query(query); Assert.IsInstanceOf(typeof(PagedResponse <ContentItemTypeA <Model.HaloWars2.Metadata.CampaignLevel.View> >), result); }
public async Task GetConstructedUri_InvalidSkip(int skip) { var query = new HaloSharp.Query.HaloWars2.Metadata.GetCampaignLevels() .Skip(skip); await Global.Session.Query(query); Assert.Fail("An exception should have been thrown"); }
public async Task GetCampaignLevels_IsSerializable() { var query = new HaloSharp.Query.HaloWars2.Metadata.GetCampaignLevels() .SkipCache(); var result = await Global.Session.Query(query); SerializationUtility <PagedResponse <ContentItemTypeA <Model.HaloWars2.Metadata.CampaignLevel.View> > > .AssertRoundTripSerializationIsPossible(result); }
public void Uri_MatchesExpected(int skip) { var query = new HaloSharp.Query.HaloWars2.Metadata.GetCampaignLevels(); Assert.AreEqual("https://www.haloapi.com/metadata/hw2/campaign-levels", query.Uri); query.Skip(skip); Assert.AreEqual($"https://www.haloapi.com/metadata/hw2/campaign-levels?startAt={skip}", query.Uri); }
public async Task GetCampaignLevels_SchemaIsValid() { var jSchema = JSchema.Parse(File.ReadAllText(Schema), new JSchemaReaderSettings { Resolver = new JSchemaUrlResolver(), BaseUri = new Uri(Path.GetFullPath(Schema)) }); var query = new HaloSharp.Query.HaloWars2.Metadata.GetCampaignLevels() .SkipCache(); var jArray = await Global.Session.Get <JObject>(query.Uri); SchemaUtility.AssertSchemaIsValid(jSchema, jArray); }
public async Task GetCampaignLevels_ModelMatchesSchema() { var schema = JSchema.Parse(File.ReadAllText(Schema), new JSchemaReaderSettings { Resolver = new JSchemaUrlResolver(), BaseUri = new Uri(Path.GetFullPath(Schema)) }); var query = new HaloSharp.Query.HaloWars2.Metadata.GetCampaignLevels() .SkipCache(); var result = await Global.Session.Query(query); var json = JsonConvert.SerializeObject(result); var jContainer = JsonConvert.DeserializeObject <JObject>(json); SchemaUtility.AssertSchemaIsValid(schema, jContainer); }