Permalink
Browse files

Add failing byte[] property deserialization test.

  • Loading branch information...
1 parent 53a453a commit 14df5ebaa332da10405299d93dac76c02525282d @lanwin lanwin committed Jun 29, 2010
Showing with 20 additions and 0 deletions.
  1. +20 −0 source/MongoDB.Tests/UnitTests/Serialization/SerializationFactoryTests.cs
@@ -272,5 +272,25 @@ public void CanSerializerAndDesializeEnumLists()
Assert.IsNotNull(deserialize.Tests);
Assert.Contains(EnumHelper.Test.A, deserialize.Tests);
}
+
+ public class ByteArrayHelper
+ {
+ public byte[] Property { get; set; }
+ }
+
+ [Test]
+ public void CanWriteByteArrayPropertyFromBinary()
+ {
+ var bson = Serialize(new Document("Property", new Binary(new byte[] {1, 2, 3, 4})));
+
+ var helper = Deserialize<ByteArrayHelper>(bson);
+
+ Assert.IsNotNull(helper);
+ Assert.AreEqual(4, helper.Property.Length);
+ Assert.AreEqual(1, helper.Property[0]);
+ Assert.AreEqual(2, helper.Property[1]);
+ Assert.AreEqual(3, helper.Property[2]);
+ Assert.AreEqual(4, helper.Property[3]);
+ }
}
}

0 comments on commit 14df5eb

Please sign in to comment.