Fixed build on Net20 Tests.

Didn't realize HashSet wasn't available in Net20.
This commit is contained in:
TylerBrinkley
2016-08-08 09:36:15 -05:00
parent 4605894b6b
commit a771eab395
2 changed files with 20 additions and 17 deletions
@@ -374,6 +374,7 @@
</ItemGroup>
<ItemGroup>
<Service Include="{3259AA49-8AA1-44D3-9025-A0B520596A8C}" />
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
</ItemGroup>
<ItemGroup>
<None Include="LinqToSql\LinqToSqlClasses.dbml.layout">
@@ -9563,6 +9563,25 @@ Path '', line 1, position 1.");
}
#endif
#if !NET20
[Test]
public void DeserializeDictionaryOfHashSetsWithTypeNameHandlingAll()
{
var dictionary = new Dictionary<int, HashSet<string>>
{
{ 1, new HashSet<string>(new[] { "test" }) },
};
var jsonSerializerSettings = new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.All };
var obtainedJson = JsonConvert.SerializeObject(dictionary, jsonSerializerSettings);
var obtainedDictionary = (Dictionary<int, HashSet<string>>)JsonConvert.DeserializeObject(obtainedJson, jsonSerializerSettings);
Assert.IsNotNull(obtainedDictionary);
}
#endif
#if !(NETFX_CORE || DNXCORE50)
[Test]
public void MailMessageConverterTest()
@@ -9618,23 +9637,6 @@ Path '', line 1, position 1.");
"Cannot populate list type System.Net.Mime.HeaderCollection. Path 'Headers', line 26, position 14.");
}
[Test]
public void DeserializeDictionaryOfHashSetsWithTypeNameHandlingAll()
{
var dictionary = new Dictionary<int, HashSet<string>>
{
{ 1, new HashSet<string>(new[] { "test" }) },
};
var jsonSerializerSettings = new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.All };
var obtainedJson = JsonConvert.SerializeObject(dictionary, jsonSerializerSettings);
var obtainedDictionary = (Dictionary<int, HashSet<string>>)JsonConvert.DeserializeObject(obtainedJson, jsonSerializerSettings);
Assert.IsNotNull(obtainedDictionary);
}
public class MailAddressReadConverter : JsonConverter
{
public override bool CanConvert(Type objectType)