Apolyton_FastJson_Binaries__v0.92_.zip
Output
Debug
Apolyton.FastJson.dll
Apolyton.FastJson.pdb
Release x64
Apolyton.FastJson.dll
Release x86
Apolyton.FastJson.dll
consoletest.exe
consoletest.vshost.exe
consoletest.vshost.exe.manifest
fastJSON.dll
Release
Apolyton.FastJson.dll
Silverlight
Apolyton.Json.Silverlight.dll
Apolyton.Json.Silverlight.pdb
Apolyton_FastJson_Binaries__v0.93_.zip
Apolyton.FastJson.dll
Apolyton.FastJson.pdb
consoletest.exe
consoletest.pdb
fastJSON.dll
Apolyton.FastJson.dll
consoletest.exe
consoletest.vshost.exe
fastJSON.dll
Apolyton.FastJson.dll
consoletest.exe
consoletest.vshost.exe
fastJSON.dll
Apolyton.FastJson.dll
consoletest.exe
fastJSON.dll
Apolyton.Json.Silverlight.dll
Apolyton.Json.Silverlight.pdb
Apolyton_FastJson_Binaries__v0.9_.zip
Apolyton.FastJson.dll
Apolyton.FastJson.pdb
Apolyton.FastJson.dll
Apolyton.FastJson.pdb
consoletest.exe
consoletest.vshost.exe
consoletest.vshost.exe.manifest
fastJSON.dll
fastJSON.pdb
Apolyton.FastJson.dll
consoletest.exe
consoletest.vshost.exe
fastJSON.dll
Apolyton.FastJson.dll
Apolyton.FastJson.pdb
consoletest.exe
consoletest.vshost.exe
consoletest.vshost.exe.manifest
fastJSON.dll
fastJSON.pdb
Apolyton_FastJson_Sources__v0.92_.zip
Apolyton.FastJson.Tests
bin
Debug
Release
Apolyton.FastJson.dll
Apolyton.FastJSON.Tests.dll
Apolyton.FastJSON.Tests.pdb
Data
Helpers
ComplexTypes
ParameterRelated
Polymorphism
RegistryHelpers
StandardTypes
obj
Debug
Apolyton.FastJson.Tests.csprojResolveAssemblyReference.cache
Apolyton.FastJSON.Tests.dll
Apolyton.FastJSON.Tests.pdb
build.force
DesignTimeResolveAssemblyReferencesInput.cache
TempPE
Release (x86, CUSTOM TYPES)
build.force
DesignTimeResolveAssemblyReferencesInput.cache
TempPE
Release
Apolyton.FastJson.Tests.csprojResolveAssemblyReference.cache
Apolyton.FastJSON.Tests.dll
Apolyton.FastJSON.Tests.pdb
DesignTimeResolveAssemblyReferencesInput.cache
TempPE
Properties
Registry
Serialization
Apolyton.FastJson
Apolyton.FastJson.csproj.user
Apolyton.FastJson.Silverlight.csproj.user
Apolyton.FastJson.v11.suo
Bin
Debug
Apolyton.Json.Silverlight.dll
Apolyton.Json.Silverlight.pdb
Common
Data
Diagram.cd
obj
Debug
Apolyton.FastJson.dll
Apolyton.FastJson.pdb
Apolyton.Json.Silverlight.dll
Apolyton.Json.Silverlight.pdb
DesignTimeResolveAssemblyReferencesInput.cache
TempPE
Release x64
Apolyton.FastJson.dll
DesignTimeResolveAssemblyReferencesInput.cache
TempPE
Release x86
Apolyton.FastJson.dll
DesignTimeResolveAssemblyReferencesInput.cache
TempPE
Release
Apolyton.FastJson.dll
DesignTimeResolveAssemblyReferencesInput.cache
TempPE
Properties
Registry
Serialization
Console Test
bin
Debug
Apolyton.FastJson.dll
Apolyton.FastJson.pdb
consoletest.exe
consoletest.pdb
consoletest.vshost.exe
fastJSON.dll
fastJSON.pdb
x86
DataObjects
obj
Debug
build.force
consoletest.csprojResolveAssemblyReference.cache
consoletest.exe
consoletest.pdb
DesignTimeResolveAssemblyReferencesInput.cache
TempPE
Release (x86, CUSTOM TYPES)
DesignTimeResolveAssemblyReferencesInput.cache
TempPE
Release x64
consoletest.csprojResolveAssemblyReference.cache
consoletest.exe
DesignTimeResolveAssemblyReferencesInput.cache
TempPE
Release x86
consoletest.csprojResolveAssemblyReference.cache
consoletest.exe
DesignTimeResolveAssemblyReferencesInput.cache
TempPE
Release
build.force
consoletest.csprojResolveAssemblyReference.cache
consoletest.exe
DesignTimeResolveAssemblyReferencesInput.cache
TempPE
x86
Debug
TempPE
Apolyton_FastJson_Sources__v0.93_.zip
Apolyton.FastJson.dll
Apolyton.FastJSON.Tests.dll
Apolyton.FastJSON.Tests.pdb
Apolyton.FastJson.dll
Apolyton.FastJSON.Tests.dll
Apolyton.FastJSON.Tests.pdb
Apolyton.FastJson.Tests.csprojResolveAssemblyReference.cache
Apolyton.FastJSON.Tests.dll
Apolyton.FastJSON.Tests.pdb
DesignTimeResolveAssemblyReferencesInput.cache
build.force
DesignTimeResolveAssemblyReferencesInput.cache
Apolyton.FastJson.Tests.csprojResolveAssemblyReference.cache
Apolyton.FastJSON.Tests.dll
Apolyton.FastJSON.Tests.pdb
DesignTimeResolveAssemblyReferencesInput.cache
Apolyton.FastJson.csproj.user
Apolyton.FastJson.Silverlight.csproj.user
Apolyton.FastJson.v11.suo
Apolyton.Json.Silverlight.dll
Apolyton.Json.Silverlight.pdb
Release
Apolyton.Json.Silverlight.dll
Apolyton.Json.Silverlight.pdb
Diagrams
Json.cd
JsonParameters.cd
TypeDescriptors.cd
Apolyton.FastJson.dll
Apolyton.FastJson.pdb
Apolyton.Json.Silverlight.dll
Apolyton.Json.Silverlight.pdb
DesignTimeResolveAssemblyReferencesInput.cache
Apolyton.FastJson.dll
DesignTimeResolveAssemblyReferencesInput.cache
Apolyton.FastJson.dll
DesignTimeResolveAssemblyReferencesInput.cache
Apolyton.FastJson.dll
Apolyton.Json.Silverlight.dll
Apolyton.Json.Silverlight.pdb
DesignTimeResolveAssemblyReferencesInput.cache
Apolyton.FastJson.dll
Apolyton.FastJson.pdb
consoletest.exe
consoletest.pdb
consoletest.vshost.exe
fastJSON.dll
Release
Apolyton.FastJson.dll
consoletest.exe
fastJSON.dll
Release (x86, CUSTOM TYPES)
Apolyton.FastJson.dll
consoletest.exe
fastJSON.dll
Release x64
Apolyton.FastJson.dll
consoletest.exe
fastJSON.dll
consoletest.csprojResolveAssemblyReference.cache
consoletest.exe
consoletest.pdb
DesignTimeResolveAssemblyReferencesInput.cache
DesignTimeResolveAssemblyReferencesInput.cache
consoletest.csprojResolveAssemblyReference.cache
consoletest.exe
DesignTimeResolveAssemblyReferencesInput.cache
consoletest.csprojResolveAssemblyReference.cache
consoletest.exe
DesignTimeResolveAssemblyReferencesInput.cache
consoletest.csprojResolveAssemblyReference.cache
consoletest.exe
DesignTimeResolveAssemblyReferencesInput.cache
consoletest.csprojResolveAssemblyReference.cache
consoletest.exe
consoletest.pdb
DesignTimeResolveAssemblyReferencesInput.cache
Release x64
consoletest.csprojResolveAssemblyReference.cache
consoletest.exe
DesignTimeResolveAssemblyReferencesInput.cache
Release x86
consoletest.csprojResolveAssemblyReference.cache
consoletest.exe
DesignTimeResolveAssemblyReferencesInput.cache
Release
consoletest.csprojResolveAssemblyReference.cache
consoletest.exe
DesignTimeResolveAssemblyReferencesInput.cache
Apolyton_FastJson_Sources__v0.9_.zip
Apolyton.FastJson.Tests.csprojResolveAssemblyReference.cache
Apolyton.FastJSON.Tests.dll
Apolyton.FastJSON.Tests.pdb
DesignTimeResolveAssemblyReferencesInput.cache
build.force
DesignTimeResolveAssemblyReferencesInput.cache
Apolyton.FastJson.Tests.csprojResolveAssemblyReference.cache
Apolyton.FastJSON.Tests.dll
Apolyton.FastJSON.Tests.pdb
DesignTimeResolveAssemblyReferencesInput.cache
Apolyton.FastJson.csproj.user
Diagram.cd
consoletest.vshost.exe
consoletest.csprojResolveAssemblyReference.cache
consoletest.exe
consoletest.pdb
DesignTimeResolveAssemblyReferencesInput.cache
DesignTimeResolveAssemblyReferencesInput.cache
consoletest.csprojResolveAssemblyReference.cache
consoletest.exe
DesignTimeResolveAssemblyReferencesInput.cache
consoletest.csprojResolveAssemblyReference.cache
consoletest.exe
DesignTimeResolveAssemblyReferencesInput.cache
consoletest.csprojResolveAssemblyReference.cache
consoletest.exe
DesignTimeResolveAssemblyReferencesInput.cache
|
using System;
using Apolyton.FastJson.Data;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Apolyton.FastJson.Tests
{
[TestClass]
public class JsonHybridDeserializerTests
{
private JsonParameters CreateTestParameters()
{
return new JsonParameters()
{
UseUtcDateTime = true,
UseTypeExtension = false,
UseGlobalTypes = false
};
}
[TestMethod]
public void JsonHybridDeserializer_Constructor()
{
JsonHybridDeserializer deserializer = new JsonHybridDeserializer(new JsonParameters());
}
[TestMethod]
public void JsonHybridDeserializer_Integer()
{
JsonHybridDeserializer deserializer = new JsonHybridDeserializer(new JsonParameters());
String jsonString = "{\"Integer\":1,\"NullableInteger\":2}";
var jsonObject = (MutableJsonObject) deserializer.Deserialize(ref jsonString);
Assert.IsTrue(jsonObject.ContainsKey("Integer"));
Assert.IsTrue(jsonObject.ContainsKey("NullableInteger"));
Assert.AreEqual((Int64) 1, jsonObject["Integer"]);
Assert.AreEqual((Int64) 2, jsonObject["NullableInteger"]);
}
[TestMethod]
public void JsonHybridDeserializer_Bool()
{
JsonHybridDeserializer deserializer = new JsonHybridDeserializer(new JsonParameters());
String jsonString = "{\"Bool\":true,\"NullableBool\":true}";
var jsonObject = (MutableJsonObject)deserializer.Deserialize(ref jsonString);
Assert.IsTrue(jsonObject.ContainsKey("Bool"));
Assert.IsTrue(jsonObject.ContainsKey("NullableBool"));
Assert.AreEqual(true, jsonObject["Bool"]);
Assert.AreEqual(true, jsonObject["NullableBool"]);
}
[TestMethod]
public void JsonHybridDeserializer_Double()
{
JsonHybridDeserializer deserializer = new JsonHybridDeserializer(new JsonParameters());
String jsonString = "{\"Double\":1.1,\"NullableDouble\":1.2}";
var jsonObject = (MutableJsonObject)deserializer.Deserialize(ref jsonString);
Assert.IsTrue(jsonObject.ContainsKey("Double"));
Assert.IsTrue(jsonObject.ContainsKey("NullableDouble"));
Assert.AreEqual(1.1, jsonObject["Double"]);
Assert.AreEqual(1.2, jsonObject["NullableDouble"]);
}
/// <summary>
/// Verifies that byte arrays are deserialized as strings (the serializer doesn't know it better).
/// </summary>
[TestMethod]
public void JsonHybridDeserializer_ByteArray_AsString()
{
JsonHybridDeserializer deserializer = new JsonHybridDeserializer(new JsonParameters());
String jsonString = "{\"ByteArray\":\"AQID\"}";
var jsonObject = (MutableJsonObject)deserializer.Deserialize(ref jsonString);
Assert.IsTrue(jsonObject.ContainsKey("ByteArray"));
Assert.AreEqual("AQID", jsonObject["ByteArray"]);
}
/// <summary>
/// Verifies that date values are deserialized as strings (the serializer doesn't know it better).
/// </summary>
[TestMethod]
public void JsonHybridDeserializer_DateTime_AsString()
{
JsonHybridDeserializer deserializer = new JsonHybridDeserializer(new JsonParameters());
String jsonString = "{\"DateTime\":\"1955-03-04 09:22:33Z\",\"NullableDateTime\":\"1956-04-05 08:22:33Z\"}";
var jsonObject = (MutableJsonObject)deserializer.Deserialize(ref jsonString);
Assert.IsTrue(jsonObject.ContainsKey("DateTime"));
Assert.AreEqual("1955-03-04 09:22:33Z", jsonObject["DateTime"]);
Assert.AreEqual("1956-04-05 08:22:33Z", jsonObject["NullableDateTime"]);
}
[TestMethod]
public void JsonHybridDeserializer_Dictionary()
{
JsonHybridDeserializer deserializer = new JsonHybridDeserializer(new JsonParameters());
String jsonString = "{\"Field1\":\"Value1\", \"Field2\":\"Value2\"}";
var jsonObject = (MutableJsonObject)deserializer.Deserialize(ref jsonString);
Assert.IsTrue(jsonObject.ContainsKey("Field1"));
Assert.IsTrue(jsonObject.ContainsKey("Field2"));
Assert.AreEqual("Value1", jsonObject["Field1"]);
Assert.AreEqual("Value2", jsonObject["Field2"]);
}
[TestMethod]
public void JsonHybridDeserializer_Enumerations()
{
JsonHybridDeserializer deserializer = new JsonHybridDeserializer(new JsonParameters());
String jsonString = "{\"Dictionary\":[{\"k\":1,\"v\":2},{\"k\":3,\"v\":5}]}";
var jsonObject = (MutableJsonObject)deserializer.Deserialize(ref jsonString);
Assert.IsTrue(jsonObject.ContainsKey("Dictionary"));
var array = (MutableJsonArray)jsonObject["Dictionary"];
var dictionary = (MutableJsonObject)array[0];
Assert.IsTrue(dictionary.ContainsKey("k"));
Assert.IsTrue(dictionary.ContainsKey("v"));
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of use and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.