public void ShouldReturnJsonObject() { //arrange string expectedJson = "\"characterAttributes\":[{\"characterAttribute\":\"STR\",\"value\":0},{\"characterAttribute\":\"DEX\",\"value\":0},{\"characterAttribute\":\"CON\",\"value\":0},{\"characterAttribute\":\"INT\",\"value\":0},{\"characterAttribute\":\"WIS\",\"value\":0},{\"characterAttribute\":\"CHR\",\"value\":0},]"; StringBuilder sb = new StringBuilder(); //act _attributeSet.AddJsonToStringbuilder(sb); //assert sb.ToString().Should().Be(expectedJson); }
public void AddJsonToStringbuilder(StringBuilder stringbuilder) { stringbuilder.Append("{characterSheet:{"); _race.AddJsonToStringbuilder(stringbuilder); stringbuilder.Append(","); _characterClass.AddJsonToStringbuilder(stringbuilder); stringbuilder.Append(","); _attributeSet.AddJsonToStringbuilder(stringbuilder); stringbuilder.Append(","); stringbuilder.Append("\"Proficiencies\":["); stringbuilder.Append(string.Join(",", Proficiencies().Select(x => $"\"{x}\""))); stringbuilder.Append("],"); stringbuilder.Append("}}"); }