public void TryGetItemSerializationInfo_should_return_expected_result()
        {
            var subject = new JsonDotNetSerializer<int[]>();

            BsonSerializationInfo info;
            var result = subject.TryGetItemSerializationInfo(out info);

            result.Should().BeTrue();
            info.ElementName.Should().BeNull();
            info.NominalType.Should().Be(typeof(int));
            info.Serializer.Should().BeOfType<JsonDotNetSerializer<int>>();
            info.Serializer.ValueType.Should().Be(typeof(int));
        }
        public void TryGetItemSerializationInfo_should_throw_when_contract_has_a_converter()
        {
            var wrappedSerializer = new Newtonsoft.Json.JsonSerializer();
            var intContract = new Newtonsoft.Json.Serialization.JsonPrimitiveContract(typeof(int))
            {
                Converter = Substitute.For<Newtonsoft.Json.JsonConverter>()
            };
            wrappedSerializer.ContractResolver = new DictionaryContractResolver(
                new Dictionary<Type, JsonContract>
                {
                    { typeof(int), intContract }
                });
            var subject = new JsonDotNetSerializer<int[]>(wrappedSerializer);

            BsonSerializationInfo info;
            Action action = () => subject.TryGetItemSerializationInfo(out info);

            action.ShouldThrow<BsonSerializationException>().And.Message.Contains("has a Converter");
        }
        public void TryGetItemSerializationInfo_should_throw_when_contract_is_not_an_array_contract()
        {
            var subject = new JsonDotNetSerializer<C>();

            BsonSerializationInfo info;
            Action action = () => subject.TryGetItemSerializationInfo(out info);

            action.ShouldThrow<BsonSerializationException>().And.Message.Contains("is not a JsonArrayContract");
        }