예제 #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));
        }
예제 #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));
        }
예제 #3
0
 public void AddOrUpdateSurrogate_NullSurrogate_ThrowsArgumentNullException()
 {
     // ReSharper disable AssignNullToNotNullAttribute
     Serialize.AddOrUpdateSurrogate(typeof(TestClass), null);
     // ReSharper restore AssignNullToNotNullAttribute
 }
예제 #4
0
 public void AddOrUpdateSurrogate_SurrogateNotISerializationSurrogate_ThrowsArgumentOutOfRangeException()
 {
     Serialize.AddOrUpdateSurrogate(typeof(TestClass), typeof(NonSurrogateTestClass));
 }
예제 #5
0
 public void AddOrUpdateSurrogate_InterfacePassedAsSurrogate_ThrowsArgumentOutOfRangeException()
 {
     Serialize.AddOrUpdateSurrogate(typeof(TestClass), typeof(ISerializationSurrogate));
 }