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