public void SerializeStatic() { var config = new SerializerConfig(); config.ConfigStaticType(typeof(StaticClassTest)) .Members.First(m => m.PersistentName == "NotIncluded3") .SerializationOverride = SerializationOverride.ForceSkip; var ceras = new CerasSerializer(config); var dataDefault = ceras.Advanced.SerializeStatic(typeof(StaticClassTest)); StaticClassTest.ValueField = 1; StaticClassTest.StringField = "2"; StaticClassTest.FloatProp = 3; StaticClassTest.ListProp = new List <int> { 4, 4, 4, 4 }; StaticClassTest.NotIncluded1 = 5; StaticClassTest.NotIncluded2 = 6; StaticClassTest.NotIncluded3 = 7; var dataChanged = ceras.Advanced.SerializeStatic(typeof(StaticClassTest)); // // Check if the "reset" works // ceras.Advanced.DeserializeStatic(typeof(StaticClassTest), dataDefault); Assert.True(StaticClassTest.ValueField == -3); Assert.True(StaticClassTest.StringField == "-3"); Assert.True(StaticClassTest.FloatProp == -3); Assert.True(StaticClassTest.ListProp.Count == 1 && StaticClassTest.ListProp[0] == -3); // Those should still be like we last changed them Assert.True(StaticClassTest.NotIncluded1 == 5); Assert.True(StaticClassTest.NotIncluded2 == 6); Assert.True(StaticClassTest.NotIncluded3 == 7); // // Now we restore the changed state // ceras.Advanced.DeserializeStatic(typeof(StaticClassTest), dataChanged); Assert.True(StaticClassTest.ValueField == 1); Assert.True(StaticClassTest.StringField == "2"); Assert.True(StaticClassTest.FloatProp == 3); Assert.True(StaticClassTest.ListProp.Count == 4 && StaticClassTest.ListProp.All(x => x == 4)); // Those should still be like we last changed them Assert.True(StaticClassTest.NotIncluded1 == 5); Assert.True(StaticClassTest.NotIncluded2 == 6); Assert.True(StaticClassTest.NotIncluded3 == 7); }