Example #1
0
        public void SurrogateSelector_SetUsingOrdinaryFormOfAddOrUpdateSurrogate_ContainsAddedSurrogates()
        {
            Serialize.AddOrUpdateSurrogate(typeof(TestClass3), typeof(SurrogateTestClass));
            ISurrogateSelector selector;

            Assert.IsInstanceOfType(
                Serialize.SurrogateSelector.GetSurrogate(typeof(TestClass3), new StreamingContext(), out selector),
                typeof(SurrogateTestClass));
        }
Example #2
0
        public void GetXmlFormatter_SurrogatePreviouslyAdded_SurrogateExistsInSurrogateSelectorOfResult()
        {
            Serialize.AddOrUpdateSurrogate(typeof(TestClass5), typeof(SurrogateTestClass));
            XmlFormatter       formatter = Serialize.GetXmlFormatter();
            ISurrogateSelector selector;

            Assert.IsInstanceOfType(
                formatter.SurrogateSelector.GetSurrogate(typeof(TestClass5), new StreamingContext(), out selector),
                typeof(SurrogateTestClass));
        }
Example #3
0
 public void AddOrUpdateSurrogate_NullSurrogate_ThrowsArgumentNullException()
 {
     // ReSharper disable AssignNullToNotNullAttribute
     Serialize.AddOrUpdateSurrogate(typeof(TestClass), null);
     // ReSharper restore AssignNullToNotNullAttribute
 }
Example #4
0
 public void AddOrUpdateSurrogate_SurrogateNotISerializationSurrogate_ThrowsArgumentOutOfRangeException()
 {
     Serialize.AddOrUpdateSurrogate(typeof(TestClass), typeof(NonSurrogateTestClass));
 }
Example #5
0
 public void AddOrUpdateSurrogate_InterfacePassedAsSurrogate_ThrowsArgumentOutOfRangeException()
 {
     Serialize.AddOrUpdateSurrogate(typeof(TestClass), typeof(ISerializationSurrogate));
 }