예제 #1
0
        public void CharacterTest()
        {
            Character c = new Character("Josh", 5, ProfessionManager.GetInstance().GetProfessionData(typeof(Fighter)).GetNewInstance(), RaceManager.GetInstance().GetAllRaces()[0]);

            JsonSerializerOptions options = GetOptions();

            string s = JsonSerializer.Serialize(c, options);

            Character c2 = JsonSerializer.Deserialize <Character>(s, options);

            string s2 = JsonSerializer.Serialize(c2, options);

            Assert.AreEqual(true, c.Name == c2.Name && c2.Profession.Name == c.Profession.Name && s == s2);
        }