-Fixed tests

This commit is contained in:
James Newton-King
2014-09-03 22:27:42 +12:00
parent 1a36b4a996
commit 6cf71b805e
3 changed files with 6 additions and 16 deletions
@@ -186,7 +186,7 @@ namespace Newtonsoft.Json.Tests.Serialization
Assert.IsFalse(contract.IsInstantiable);
Assert.IsNull(contract.DefaultCreator);
Assert.IsNull(contract.ParametrizedCreator);
Assert.IsFalse(contract.HasParametrizedCreator);
ExceptionAssert.Throws<JsonSerializationException>(
"Could not create an instance of type Newtonsoft.Json.Tests.Serialization.AbstractListTestClass`1[System.Int32]. Type is an interface or abstract class and cannot be instantiated. Path '', line 1, position 1.",
@@ -268,7 +268,7 @@ namespace Newtonsoft.Json.Tests.Serialization
Assert.IsFalse(contract.IsInstantiable);
Assert.IsNull(contract.DefaultCreator);
Assert.IsNull(contract.ParametrizedCreator);
Assert.IsFalse(contract.HasParametrizedCreator);
ExceptionAssert.Throws<JsonSerializationException>(
"Could not create an instance of type Newtonsoft.Json.Tests.Serialization.AbstractDictionaryTestClass`2[System.String,System.Int32]. Type is an interface or abstract class and cannot be instantiated. Path 'key1', line 1, position 6.",
@@ -75,12 +75,7 @@ namespace Newtonsoft.Json.Serialization
get
{
if (_parametrizedCreator == null)
{
if (_parametrizedConstructor == null)
return null;
_parametrizedCreator = JsonTypeReflector.ReflectionDelegateFactory.CreateParametrizedConstructor(_parametrizedConstructor);
}
return _parametrizedCreator;
}
@@ -158,7 +153,7 @@ namespace Newtonsoft.Json.Serialization
_genericCollectionDefinitionType = typeof(List<>).MakeGenericType(CollectionItemType);
_parametrizedConstructor = CollectionUtils.ResolveEnumerableCollectionConstructor(CreatedType, CollectionItemType);
IsReadOnlyOrFixedSize = true;
canDeserialize = (ParametrizedCreator != null);
canDeserialize = HasParametrizedCreator;
}
#endif
else if (ReflectionUtils.ImplementsGenericDefinition(underlyingType, typeof(IEnumerable<>), out tempCollectionType))
@@ -171,7 +166,7 @@ namespace Newtonsoft.Json.Serialization
_parametrizedConstructor = CollectionUtils.ResolveEnumerableCollectionConstructor(underlyingType, CollectionItemType);
#if !(NET35 || NET20 || NETFX_CORE)
if (ParametrizedCreator == null && underlyingType.Name == FSharpUtils.FSharpListTypeName)
if (!HasParametrizedCreator && underlyingType.Name == FSharpUtils.FSharpListTypeName)
{
FSharpUtils.EnsureInitialized(underlyingType.Assembly());
_parametrizedCreator = FSharpUtils.CreateSeq(CollectionItemType);
@@ -192,7 +187,7 @@ namespace Newtonsoft.Json.Serialization
IsReadOnlyOrFixedSize = true;
ShouldCreateWrapper = true;
canDeserialize = (ParametrizedCreator != null);
canDeserialize = HasParametrizedCreator;
}
}
else
@@ -78,12 +78,7 @@ namespace Newtonsoft.Json.Serialization
get
{
if (_parametrizedCreator == null)
{
if (_parametrizedConstructor == null)
return null;
_parametrizedCreator = JsonTypeReflector.ReflectionDelegateFactory.CreateParametrizedConstructor(_parametrizedConstructor);
}
return _parametrizedCreator;
}
@@ -143,7 +138,7 @@ namespace Newtonsoft.Json.Serialization
_parametrizedConstructor = CollectionUtils.ResolveEnumerableCollectionConstructor(CreatedType, typeof(KeyValuePair<,>).MakeGenericType(keyType, valueType));
#if !(NET35 || NET20 || NETFX_CORE)
if (_parametrizedConstructor == null && underlyingType.Name == FSharpUtils.FSharpMapTypeName)
if (!HasParametrizedCreator && underlyingType.Name == FSharpUtils.FSharpMapTypeName)
{
FSharpUtils.EnsureInitialized(underlyingType.Assembly());
_parametrizedCreator = FSharpUtils.CreateMap(keyType, valueType);