RemoveSerializerModifier() public method

Removes the serializer modifier for a specific type.
The is null. The is null.
public RemoveSerializerModifier ( Type type, Type serializerModifierType ) : void
type System.Type The type.
serializerModifierType System.Type Type of the serializer modifier.
return void
示例#1
0
            public void RemovesSerializerModifier()
            {
                var serializationManager = new SerializationManager();

                serializationManager.AddSerializerModifier<DynamicSerializerModifierModel, DynamicSerializerModifier>();

                var modifiers = serializationManager.GetSerializerModifiers(typeof(DynamicSerializerModifierModel));

                Assert.AreEqual(1, modifiers.Length);
                Assert.AreEqual(typeof(DynamicSerializerModifier), modifiers[0].GetType());

                serializationManager.RemoveSerializerModifier<DynamicSerializerModifierModel, DynamicSerializerModifier>();

                modifiers = serializationManager.GetSerializerModifiers(typeof(DynamicSerializerModifierModel));

                Assert.AreEqual(0, modifiers.Length);
            }
示例#2
0
            public void ThrowsArgumentNullExceptionForNullType()
            {
                var serializationManager = new SerializationManager();

                ExceptionTester.CallMethodAndExpectException<ArgumentNullException>(() => serializationManager.RemoveSerializerModifier(null, typeof(DynamicSerializerModifier)));
                ExceptionTester.CallMethodAndExpectException<ArgumentNullException>(() => serializationManager.RemoveSerializerModifier(typeof(DynamicSerializerModifierModel), null));
            }