public async Task GetMatches_InvalidGamertag(string gamertag) { var query = new GetMatchHistory(gamertag); await Global.Session.Query(query); Assert.Fail("An exception should have been thrown"); }
public async Task GetMatches_DoesNotThrow(string gamertag) { var query = new GetMatchHistory(gamertag) .SkipCache(); var result = await Global.Session.Query(query); Assert.IsInstanceOf(typeof(MatchSet <PlayerMatch>), result); }
public async Task GetMatchHistory_DoesNotThrow(string player) { var query = new GetMatchHistory(player) .SkipCache(); var result = await Global.Session.Query(query); Assert.IsInstanceOf(typeof(MatchSet <Model.HaloWars2.Stats.PlayerMatch>), result); }
public async Task GetMatches_IsSerializable(string gamertag) { var query = new GetMatchHistory(gamertag) .SkipCache(); var result = await Global.Session.Query(query); SerializationUtility <MatchSet <PlayerMatch> > .AssertRoundTripSerializationIsPossible(result); }
public async Task GetMatchHistory_InvalidGamertag(string player) { var query = new GetMatchHistory(player) .SkipCache(); await Global.Session.Query(query); Assert.Fail("An exception should have been thrown"); }
public async Task GetMatchHistory_IsSerializable(string player) { var query = new GetMatchHistory(player) .SkipCache(); var result = await Global.Session.Query(query); SerializationUtility <MatchSet <Model.HaloWars2.Stats.PlayerMatch> > .AssertRoundTripSerializationIsPossible(result); }
public async Task Query_DoesNotThrow(string gamertag) { var query = new GetMatchHistory(gamertag) .SkipCache(); var result = await _mockSession.Query(query); Assert.IsInstanceOf(typeof(MatchSet <PlayerMatch>), result); Assert.AreEqual(_matchSet, result); }
public async Task GetMatches_SchemaIsValid(string gamertag) { var weaponsSchema = JSchema.Parse(File.ReadAllText(Halo5Config.MatchesJsonSchemaPath), new JSchemaReaderSettings { Resolver = new JSchemaUrlResolver(), BaseUri = new Uri(Path.GetFullPath(Halo5Config.MatchesJsonSchemaPath)) }); var query = new GetMatchHistory(gamertag) .SkipCache(); var jArray = await Global.Session.Get <JObject>(query.Uri); SchemaUtility.AssertSchemaIsValid(weaponsSchema, jArray); }
public async Task GetMatchHistory_SchemaIsValid(string player) { var jSchema = JSchema.Parse(File.ReadAllText(Schema), new JSchemaReaderSettings { Resolver = new JSchemaUrlResolver(), BaseUri = new Uri(Path.GetFullPath(Schema)) }); var query = new GetMatchHistory(player) .SkipCache(); var jArray = await Global.Session.Get <JObject>(query.Uri); SchemaUtility.AssertSchemaIsValid(jSchema, jArray); }
public void Uri_MatchesExpected(string gamertag, Enumeration.Halo5.GameMode gameMode, int skip, int take) { var query = new GetMatchHistory(gamertag); Assert.AreEqual($"https://www.haloapi.com/stats/h5/players/{gamertag}/matches", query.Uri); query.InGameMode(gameMode); Assert.AreEqual($"https://www.haloapi.com/stats/h5/players/{gamertag}/matches?modes={gameMode}", query.Uri); query.Skip(skip); Assert.AreEqual($"https://www.haloapi.com/stats/h5/players/{gamertag}/matches?modes={gameMode}&start={skip}", query.Uri); query.Take(take); Assert.AreEqual($"https://www.haloapi.com/stats/h5/players/{gamertag}/matches?modes={gameMode}&start={skip}&count={take}", query.Uri); }
public async Task GetMatches_ModelMatchesSchema(string gamertag) { var schema = JSchema.Parse(File.ReadAllText(Halo5Config.MatchesJsonSchemaPath), new JSchemaReaderSettings { Resolver = new JSchemaUrlResolver(), BaseUri = new Uri(Path.GetFullPath(Halo5Config.MatchesJsonSchemaPath)) }); var query = new GetMatchHistory(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, Enumeration.HaloWars2.MatchType matchType, int skip, int take) { var query = new GetMatchHistory(player); Assert.AreEqual($"https://www.haloapi.com/stats/hw2/players/{player}/matches", query.Uri); query.ForMatchType(matchType); Assert.AreEqual($"https://www.haloapi.com/stats/hw2/players/{player}/matches?matchType={matchType}", query.Uri); query.Skip(skip); Assert.AreEqual($"https://www.haloapi.com/stats/hw2/players/{player}/matches?matchType={matchType}&start={skip}", query.Uri); query.Take(take); Assert.AreEqual($"https://www.haloapi.com/stats/hw2/players/{player}/matches?matchType={matchType}&start={skip}&count={take}", query.Uri); }