public void ShouldDetectStreamInconsistentConfiguration()
{
var obj = new TestClass();
var mstream = new MemoryStream();
var serializer = CreateSerializer();
serializer.Serialize(obj, mstream);
mstream.Seek(0, SeekOrigin.Begin);
var deserializer = CreateDeserializer();
try
{
deserializer.Deserialize<TestClass>(mstream);
if(serializeWithStamps != deserializeWithStamps)
{
Assert.Fail("Should not deserialize when stream configuration is inconsistent.");
}
}
catch(Exception e)
{
if(serializeWithStamps == deserializeWithStamps)
{
Console.WriteLine(e.Message);
Assert.Fail("Should deserialize when stream configuration is correct.");
}
}
}