Exemplo n.º 1
0
        public void ExportEnumsTest()
        {
            EnumsTest e_test = new EnumsTest();

            e_test.FavouritePlanet = Planets.Saturn;
            e_test.Band            = Instruments.Bass | Instruments.Harp;

            string json = JsonMapper.ToJson(e_test);

            Assert.AreEqual("{\"FavouritePlanet\":1,\"Band\":9}", json);
        }
Exemplo n.º 2
0
        public void ImportEnumsTest()
        {
            string json = @"
                {
                    ""FavouritePlanet"" : 4,
                    ""Band"" : 6
                }";

            EnumsTest e_test = JsonMapper.ToObject <EnumsTest> (json);

            Assert.AreEqual(Planets.Pluto, e_test.FavouritePlanet, "A1");
            Assert.AreEqual(Instruments.Guitar
                            | Instruments.Drums, e_test.Band, "A2");
        }
Exemplo n.º 3
0
        public void ExportEnumsTest()
        {
            EnumsTest e_test = new EnumsTest ();

            e_test.FavouritePlanet = Planets.Saturn;
            e_test.Band = Instruments.Bass | Instruments.Harp;

            string json = JsonMapper.ToJson (e_test);

            Assert.AreEqual ("{\"FavouritePlanet\":1,\"Band\":9}", json);
        }