public void LevelParse_NoCharts_ThrowsError() { (Level actual, string json) = JsonHelper.GenerateLevel("testpack", new Chart[0]); Assert.Throws <JsonReaderException>(() => { JObject jobj = JObject.Parse(json); Level level = JsonUserInput.ReadLevelJson(jobj.CreateReader()); }); }
public void LevelParse_NoPacks_Success() { (Level actual, string json) = JsonHelper.GenerateLevel(null, new Chart[] { getDummyChart() }); JObject jobj = JObject.Parse(json); Level level = JsonUserInput.ReadLevelJson(jobj.CreateReader()); Assert.IsNull(level.PackExternalId); }
public void LevelParse_Success(int chartCount) { Chart[] charts = new Chart[chartCount]; for (int i = 0; i < chartCount; i++) { charts[i] = getDummyChart(); } (Level actual, string json) = JsonHelper.GenerateLevel("testpack", charts); JObject jobj = JObject.Parse(json); Level level = JsonUserInput.ReadLevelJson(jobj.CreateReader()); Assert.That( level.PackExternalId == "testpack" && level.Charts.Length == chartCount, json ); }