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); }
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"); }