Skip to content

Commit

Permalink
Remove BinaryFormatter conformance tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ReubenBond committed Oct 25, 2023
1 parent 27b07f6 commit 5a82c37
Showing 1 changed file with 0 additions and 48 deletions.
48 changes: 0 additions & 48 deletions test/Orleans.Serialization.UnitTests/ISerializableTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,31 +38,6 @@ public ISerializableTests(ITestOutputHelper log)
_log = log;
}

#pragma warning disable SYSLIB0011 // Type or member is obsolete
private static object DotNetSerializationLoop(object input)
{
byte[] bytes;
object deserialized;
#pragma warning disable SYSLIB0050 // Type or member is obsolete
var formatter = new BinaryFormatter
{
Context = new StreamingContext(StreamingContextStates.All, null)
};
#pragma warning restore SYSLIB0050 // Type or member is obsolete
using (var str = new MemoryStream())
{
formatter.Serialize(str, input);
str.Flush();
bytes = str.ToArray();
}
using (var inStream = new MemoryStream(bytes))
{
deserialized = formatter.Deserialize(inStream);
}
return deserialized;
}
#pragma warning restore SYSLIB0011 // Type or member is obsolete

private object SerializationLoop(object original)
{
var pipe = new Pipe();
Expand Down Expand Up @@ -129,17 +104,6 @@ public void ISerializableObjectWithCallbacks()
result.History);
Assert.Equal(input.Payload, result.Payload, StringComparer.Ordinal);
Assert.Equal(3, result.Contexts.Count);

// Verify that our behavior conforms to the behavior of BinaryFormatter.
var input2 = new SimpleISerializableObject
{
Payload = "pyjamas"
};

var result2 = (SimpleISerializableObject)DotNetSerializationLoop(input2);

Assert.Equal(input2.History, input.History);
Assert.Equal(result2.History, result.History);
}

/// <summary>
Expand All @@ -165,18 +129,6 @@ public void ISerializableStructWithCallbacks()
result.History);
Assert.Equal(input.Payload, result.Payload, StringComparer.Ordinal);
Assert.Equal(2, result.Contexts.Count);
//Assert.All(result.Contexts, ctx => Assert.True(ctx.Context is IDeserializationContext));

// Verify that our behavior conforms to the behavior of BinaryFormatter.
var input2 = new SimpleISerializableStruct
{
Payload = "pyjamas"
};

var result2 = (SimpleISerializableStruct)DotNetSerializationLoop(input2);

Assert.Equal(input2.History, input.History);
Assert.Equal(result2.History, result.History);
}

private class BaseException : Exception
Expand Down

0 comments on commit 5a82c37

Please sign in to comment.