Пример #1
0
        public void CanLoadState()
        {
            var json = @"{
  ""State"": 1,
  ""Floor"": [
    ""............"",
    ""............"",
    ""............"",
    ""............"",
    ""............"",
    ""............"",
    ""............"",
    ""............"",
    ""............"",
    ""............"",
    ""............"",
    ""............"",
    ""............"",
    ""............"",
    ""............"",
    "".L.........J"",
    "".L....SS...J"",
    "".LL..SS...JJ""
  ],
  ""ActiveT"": ""O"",
  ""ActiveX"": 5,
  ""ActiveY"": 5,
  ""ActiveR"": 0,
  ""Speed"": 0,
  ""Score"": 20,
  ""NextT"": ""T""
}";

            outp.WriteLine(json);

            var game = new TetrisGame();

            game.Load(JsonConvert.DeserializeObject <TetrisGameStateDto>(json));


            var round = JsonConvert.SerializeObject(game.CaptureState(), Formatting.Indented);

            outp.WriteLine(round);

            Assert.Equal(json, round);
        }