Esempio n. 1
0
 public ActionResult <string> GetTiles()
 {
     if (MasterGameController.TheGame.Tiles == null)
     {
         return(NotFound());
     }
     return(TileSerializer.SerializeList(MasterGameController.TheGame.Tiles));
 }
Esempio n. 2
0
        public void TileListSerializesToJson()
        {
            Tile        tile  = new Tile(123, TileMovementFlags.BulletPassable | TileMovementFlags.Passable);
            Tile        tile2 = new Tile(127, TileMovementFlags.BulletPassable);
            List <Tile> list  = new List <Tile> {
                tile, tile2
            };
            string serialized = TileSerializer.SerializeList(list);

            string expected = "[{\"MovementFlags\":5,\"Id\":123},{\"MovementFlags\":4,\"Id\":127}]";

            Assert.That(serialized, Is.EqualTo(expected));
        }