Skip to content

Commit

Permalink
Test | Replacing Binary formatter with DataContractSerializer (#1590)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaur-Parminder authored Aug 19, 2022
1 parent 6fdc1f3 commit bd21d76
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System;
using System.IO;
using System.Reflection;
using System.Runtime.Serialization.Formatters.Binary;
using System.Runtime.Serialization;
using Xunit;

namespace Microsoft.Data.SqlClient.Tests
Expand All @@ -20,16 +20,16 @@ public class SqlErrorTest
[Fact]
public static void SqlErrorSerializationTest()
{
var formatter = new BinaryFormatter();
DataContractSerializer serializer = new DataContractSerializer(typeof(SqlError));
SqlError expected = CreateError();
SqlError actual = null;
using (var stream = new MemoryStream())
{
try
{
formatter.Serialize(stream, expected);
serializer.WriteObject(stream, expected);
stream.Position = 0;
actual = (SqlError)formatter.Deserialize(stream);
actual = (SqlError)serializer.ReadObject(stream);
}
catch (Exception ex)
{
Expand Down

0 comments on commit bd21d76

Please sign in to comment.