46 lines
1001 B
C#
46 lines
1001 B
C#
using NUnit.Framework;
|
|
|
|
namespace ln.json.tests
|
|
{
|
|
public class JSONTests
|
|
{
|
|
[SetUp]
|
|
public void Setup()
|
|
{
|
|
}
|
|
|
|
[Test]
|
|
public void Test_00_Primitives()
|
|
{
|
|
JSONValue jsonFloat = JSONParser.Parse("1234.564");
|
|
|
|
Assert.IsTrue(jsonFloat is JSONNumber);
|
|
Assert.AreEqual(1234.564, jsonFloat.ToNative());
|
|
|
|
JSONValue jsonInteger = JSONParser.Parse("635462");
|
|
|
|
Assert.IsTrue(jsonFloat is JSONNumber);
|
|
Assert.AreEqual(635462, jsonInteger.ToNative());
|
|
|
|
|
|
Assert.Pass();
|
|
}
|
|
|
|
[Test]
|
|
public void TestArrayParser()
|
|
{
|
|
JSONParser.Parse("[]");
|
|
JSONParser.Parse("[ ]");
|
|
JSONParser.Parse("[\t]");
|
|
}
|
|
|
|
[Test]
|
|
public void TestObjectParser()
|
|
{
|
|
JSONParser.Parse("{}");
|
|
JSONParser.Parse("{ }");
|
|
JSONParser.Parse("{\t}");
|
|
}
|
|
|
|
}
|
|
} |