public void TryGetMemberSerializationInfo_should_return_expected_result_for_int_member()
        {
            var subject = new JsonDotNetSerializer<C>();

            BsonSerializationInfo info;
            var result = subject.TryGetMemberSerializationInfo("N", out info);

            result.Should().BeTrue();
            info.ElementName.Should().Be("n");
            info.NominalType.Should().Be(typeof(int));
            info.Serializer.Should().BeOfType<JsonDotNetSerializer<int>>();
            info.Serializer.ValueType.Should().Be(typeof(int));
        }
        public void TryGetMemberSerializationInfo_should_return_false_for_non_existent_member()
        {
            var subject = new JsonDotNetSerializer<C>();

            BsonSerializationInfo info;
            var result = subject.TryGetMemberSerializationInfo("X", out info);

            result.Should().BeFalse();
            info.Should().BeNull();
        }
        public void TryGetMemberSerializationInfo_should_return_false_when_class_has_converter()
        {
            var subject = new JsonDotNetSerializer<E>();

            BsonSerializationInfo info;
            Action action = () => subject.TryGetMemberSerializationInfo("F", out info);

            action.ShouldThrow<BsonSerializationException>();
        }
        public void TryGetMemberSerializationInfo_should_return_expected_result_for_nested_document_member()
        {
            var subject = new JsonDotNetSerializer<C>();

            BsonSerializationInfo info1;
            var result1 = subject.TryGetMemberSerializationInfo("D", out info1);

            result1.Should().BeTrue();
            info1.ElementName.Should().Be("d");
            info1.NominalType.Should().Be(typeof(D));
            info1.Serializer.Should().BeOfType<JsonDotNetSerializer<D>>();
            info1.Serializer.ValueType.Should().Be(typeof(D));

            BsonSerializationInfo info2;
            var result2 = ((IBsonDocumentSerializer)info1.Serializer).TryGetMemberSerializationInfo("B", out info2);

            result2.Should().BeTrue();
            info2.ElementName.Should().Be("b");
            info2.NominalType.Should().Be(typeof(bool));
            info2.Serializer.Should().BeOfType<JsonDotNetSerializer<bool>>();
            info2.Serializer.ValueType.Should().Be(typeof(bool));
        }