From 14df5ebaa332da10405299d93dac76c02525282d Mon Sep 17 00:00:00 2001 From: Steve Wagner Date: Tue, 29 Jun 2010 07:29:10 +0200 Subject: [PATCH] Add failing byte[] property deserialization test. --- .../SerializationFactoryTests.cs | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/source/MongoDB.Tests/UnitTests/Serialization/SerializationFactoryTests.cs b/source/MongoDB.Tests/UnitTests/Serialization/SerializationFactoryTests.cs index c655ff4f..a3f80a6a 100644 --- a/source/MongoDB.Tests/UnitTests/Serialization/SerializationFactoryTests.cs +++ b/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(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]); + } } } \ No newline at end of file