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