예제 #1
0
        public void Should_serialize_and_deserialize_status()
        {
            StatusSerializer.Register();

            var source = new TestObject
            {
                Status = Status.Published
            };

            var document = new BsonDocument();

            using (var writer = new BsonDocumentWriter(document))
            {
                BsonSerializer.Serialize(writer, source);

                writer.Flush();
            }

            using (var reader = new BsonDocumentReader(document))
            {
                var result = BsonSerializer.Deserialize <TestObject>(reader);

                Assert.Equal(source.Status, result.Status);
            }
        }