Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| dc737187ee | |||
| ff32ad9d1f | |||
| a4153ded57 | |||
| e4a9cb1995 |
@@ -1,6 +1,6 @@
|
|||||||
The MIT License (MIT)
|
The MIT License (MIT)
|
||||||
|
|
||||||
Copyright (c) 2016-2020 Valeriano Alfonso Rodriguez
|
Copyright (c) 2016-2021 Valeriano Alfonso Rodriguez
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
41
README.md
41
README.md
@@ -5,23 +5,46 @@
|
|||||||
### VAR.Json
|
### VAR.Json
|
||||||
Add the resulting assembly as reference in your projects, and this line on code:
|
Add the resulting assembly as reference in your projects, and this line on code:
|
||||||
|
|
||||||
using VAR.Json;
|
```csharp
|
||||||
|
using VAR.Json;
|
||||||
|
```
|
||||||
|
|
||||||
Parse any string with JSON content:
|
Parse any string with JSON content:
|
||||||
|
```csharp
|
||||||
var jsonParser = new JsonParser();
|
object result = JsonParser.ParseText("{\"Test\": 1}");
|
||||||
object result = jsonParser("{\"Test\": 1}");
|
```
|
||||||
|
|
||||||
Serialize any object to JSON:
|
Serialize any object to JSON:
|
||||||
|
```csharp
|
||||||
|
string jsonText = JsonWriter.WriteObject(new List<int>{1, 2, 3, 4});
|
||||||
|
```
|
||||||
|
|
||||||
|
### VAR.Json.JsonParser
|
||||||
|
This object can be invoked with a list of types used to cast the json objects.
|
||||||
|
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
|
||||||
|
class Person
|
||||||
|
{
|
||||||
|
public string Name { get; set; }
|
||||||
|
public string Surname { get; set; }
|
||||||
|
public DateTime DateOfBirth { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
JsonParser jsonParser = new JsonParser();
|
||||||
|
jsonParser.KnownTypes.Add(typeof(Person));
|
||||||
|
Person jsonText = jsonParser.Parse("{ \"Name\": \"John", \"Surname\": \"Doe\", \"DateOfBirth\": \"1970-01-01\"}") as Person;
|
||||||
|
```
|
||||||
|
|
||||||
var jsonWriter = new JsonWriter();
|
|
||||||
string jsonText = jsonWriter(new List<int>{1, 2, 3, 4});
|
|
||||||
|
|
||||||
## Building
|
## Building
|
||||||
A Visual Studio 2015 solutions are provided. Simply, click build on the IDE.
|
A Visual Studio solution is provided. Simply, click build on the IDE.
|
||||||
|
|
||||||
A .nuget package can be build using:
|
A .nuget package can be build using:
|
||||||
VAR.Json\Build.NuGet.cmd
|
```cmd
|
||||||
|
VAR.Json\Build.NuGet.cmd
|
||||||
|
```
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
1. Fork it!
|
1. Fork it!
|
||||||
@@ -37,7 +60,7 @@ A .nuget package can be build using:
|
|||||||
|
|
||||||
The MIT License (MIT)
|
The MIT License (MIT)
|
||||||
|
|
||||||
Copyright (c) 2016-2017 Valeriano Alfonso Rodriguez
|
Copyright (c) 2016-2021 Valeriano Alfonso Rodriguez
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
using Xunit;
|
||||||
|
|
||||||
namespace VAR.Json.Tests
|
namespace VAR.Json.Tests
|
||||||
{
|
{
|
||||||
[TestClass()]
|
|
||||||
public class JsonParser_Tests
|
public class JsonParser_Tests
|
||||||
{
|
{
|
||||||
#region Parse
|
#region Parse
|
||||||
@@ -14,15 +13,15 @@ namespace VAR.Json.Tests
|
|||||||
public int Number { get; set; }
|
public int Number { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod()]
|
[Fact]
|
||||||
public void Parse__SwallowObject()
|
public void Parse__SwallowObject()
|
||||||
{
|
{
|
||||||
JsonParser parser = new JsonParser();
|
JsonParser parser = new JsonParser();
|
||||||
parser.KnownTypes.Add(typeof(SwallowObject));
|
parser.KnownTypes.Add(typeof(SwallowObject));
|
||||||
SwallowObject result = parser.Parse(@"{""Text"": ""AAAA"", ""Number"": 42}") as SwallowObject;
|
SwallowObject result = parser.Parse(@"{""Text"": ""AAAA"", ""Number"": 42}") as SwallowObject;
|
||||||
Assert.AreEqual(false, parser.Tainted);
|
Assert.False(parser.Tainted);
|
||||||
Assert.AreEqual("AAAA", result.Text);
|
Assert.Equal("AAAA", result.Text);
|
||||||
Assert.AreEqual(42, result.Number);
|
Assert.Equal(42, result.Number);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class DeeperObject_L1
|
public class DeeperObject_L1
|
||||||
@@ -31,17 +30,17 @@ namespace VAR.Json.Tests
|
|||||||
public SwallowObject Object { get; set; }
|
public SwallowObject Object { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod()]
|
[Fact]
|
||||||
public void Parse__DeeperObject_L1()
|
public void Parse__DeeperObject_L1()
|
||||||
{
|
{
|
||||||
JsonParser parser = new JsonParser();
|
JsonParser parser = new JsonParser();
|
||||||
parser.KnownTypes.Add(typeof(SwallowObject));
|
parser.KnownTypes.Add(typeof(SwallowObject));
|
||||||
parser.KnownTypes.Add(typeof(DeeperObject_L1));
|
parser.KnownTypes.Add(typeof(DeeperObject_L1));
|
||||||
DeeperObject_L1 result = parser.Parse(@"{""Name"": ""Thing"", ""Object"": {""Text"": ""AAAA"", ""Number"": 42}}") as DeeperObject_L1;
|
DeeperObject_L1 result = parser.Parse(@"{""Name"": ""Thing"", ""Object"": {""Text"": ""AAAA"", ""Number"": 42}}") as DeeperObject_L1;
|
||||||
Assert.AreEqual(false, parser.Tainted);
|
Assert.False(parser.Tainted);
|
||||||
Assert.AreEqual("Thing", result.Name);
|
Assert.Equal("Thing", result.Name);
|
||||||
Assert.AreEqual("AAAA", result.Object.Text);
|
Assert.Equal("AAAA", result.Object.Text);
|
||||||
Assert.AreEqual(42, result.Object.Number);
|
Assert.Equal(42, result.Object.Number);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class DeeperObject_L2
|
public class DeeperObject_L2
|
||||||
@@ -50,7 +49,7 @@ namespace VAR.Json.Tests
|
|||||||
public DeeperObject_L1 Object { get; set; }
|
public DeeperObject_L1 Object { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod()]
|
[Fact]
|
||||||
public void Parse__DeeperObject_L2()
|
public void Parse__DeeperObject_L2()
|
||||||
{
|
{
|
||||||
JsonParser parser = new JsonParser();
|
JsonParser parser = new JsonParser();
|
||||||
@@ -58,23 +57,23 @@ namespace VAR.Json.Tests
|
|||||||
parser.KnownTypes.Add(typeof(DeeperObject_L1));
|
parser.KnownTypes.Add(typeof(DeeperObject_L1));
|
||||||
parser.KnownTypes.Add(typeof(DeeperObject_L2));
|
parser.KnownTypes.Add(typeof(DeeperObject_L2));
|
||||||
DeeperObject_L2 result = parser.Parse(@"{""Count"": 1, ""Object"": {""Name"": ""Thing"", ""Object"": {""Text"": ""AAAA"", ""Number"": 42}}}") as DeeperObject_L2;
|
DeeperObject_L2 result = parser.Parse(@"{""Count"": 1, ""Object"": {""Name"": ""Thing"", ""Object"": {""Text"": ""AAAA"", ""Number"": 42}}}") as DeeperObject_L2;
|
||||||
Assert.AreEqual(false, parser.Tainted);
|
Assert.False(parser.Tainted);
|
||||||
Assert.AreEqual(1, result.Count);
|
Assert.Equal(1, result.Count);
|
||||||
Assert.AreEqual("Thing", result.Object.Name);
|
Assert.Equal("Thing", result.Object.Name);
|
||||||
Assert.AreEqual("AAAA", result.Object.Object.Text);
|
Assert.Equal("AAAA", result.Object.Object.Text);
|
||||||
Assert.AreEqual(42, result.Object.Object.Number);
|
Assert.Equal(42, result.Object.Object.Number);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod()]
|
[Fact]
|
||||||
public void Parse__SwallowObjectArray()
|
public void Parse__SwallowObjectArray()
|
||||||
{
|
{
|
||||||
JsonParser parser = new JsonParser();
|
JsonParser parser = new JsonParser();
|
||||||
parser.KnownTypes.Add(typeof(SwallowObject));
|
parser.KnownTypes.Add(typeof(SwallowObject));
|
||||||
List<SwallowObject> result = parser.Parse(@"[{""Text"": ""AAAA"", ""Number"": 42}]") as List<SwallowObject>;
|
List<SwallowObject> result = parser.Parse(@"[{""Text"": ""AAAA"", ""Number"": 42}]") as List<SwallowObject>;
|
||||||
Assert.AreEqual(false, parser.Tainted);
|
Assert.False(parser.Tainted);
|
||||||
Assert.AreEqual(1, result.Count);
|
Assert.Single(result);
|
||||||
Assert.AreEqual("AAAA", result[0].Text);
|
Assert.Equal("AAAA", result[0].Text);
|
||||||
Assert.AreEqual(42, result[0].Number);
|
Assert.Equal(42, result[0].Number);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class DeeperObjectArray_L1
|
public class DeeperObjectArray_L1
|
||||||
@@ -83,17 +82,17 @@ namespace VAR.Json.Tests
|
|||||||
public List<SwallowObject> Array { get; set; }
|
public List<SwallowObject> Array { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod()]
|
[Fact]
|
||||||
public void Parse__DeeperObjectArray_L1()
|
public void Parse__DeeperObjectArray_L1()
|
||||||
{
|
{
|
||||||
JsonParser parser = new JsonParser();
|
JsonParser parser = new JsonParser();
|
||||||
parser.KnownTypes.Add(typeof(SwallowObject));
|
parser.KnownTypes.Add(typeof(SwallowObject));
|
||||||
parser.KnownTypes.Add(typeof(DeeperObjectArray_L1));
|
parser.KnownTypes.Add(typeof(DeeperObjectArray_L1));
|
||||||
DeeperObjectArray_L1 result = parser.Parse(@"{""Count"": 1, ""Array"": [{""Text"": ""AAAA"", ""Number"": 42}]}") as DeeperObjectArray_L1;
|
DeeperObjectArray_L1 result = parser.Parse(@"{""Count"": 1, ""Array"": [{""Text"": ""AAAA"", ""Number"": 42}]}") as DeeperObjectArray_L1;
|
||||||
Assert.AreEqual(false, parser.Tainted);
|
Assert.False(parser.Tainted);
|
||||||
Assert.AreEqual(1, result.Count);
|
Assert.Equal(1, result.Count);
|
||||||
Assert.AreEqual("AAAA", result.Array[0].Text);
|
Assert.Equal("AAAA", result.Array[0].Text);
|
||||||
Assert.AreEqual(42, result.Array[0].Number);
|
Assert.Equal(42, result.Array[0].Number);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class DeeperObjectArray_L2
|
public class DeeperObjectArray_L2
|
||||||
@@ -102,7 +101,7 @@ namespace VAR.Json.Tests
|
|||||||
public List<DeeperObjectArray_L1> Objects { get; set; }
|
public List<DeeperObjectArray_L1> Objects { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod()]
|
[Fact]
|
||||||
public void Parse__DeeperObjectArray_L2()
|
public void Parse__DeeperObjectArray_L2()
|
||||||
{
|
{
|
||||||
JsonParser parser = new JsonParser();
|
JsonParser parser = new JsonParser();
|
||||||
@@ -110,284 +109,284 @@ namespace VAR.Json.Tests
|
|||||||
parser.KnownTypes.Add(typeof(DeeperObjectArray_L1));
|
parser.KnownTypes.Add(typeof(DeeperObjectArray_L1));
|
||||||
parser.KnownTypes.Add(typeof(DeeperObjectArray_L2));
|
parser.KnownTypes.Add(typeof(DeeperObjectArray_L2));
|
||||||
DeeperObjectArray_L2 result = parser.Parse(@"{""Name"": ""Thing"", ""Objects"": [{""Count"": 1, ""Array"": [{""Text"": ""AAAA"", ""Number"": 42}]}]}") as DeeperObjectArray_L2;
|
DeeperObjectArray_L2 result = parser.Parse(@"{""Name"": ""Thing"", ""Objects"": [{""Count"": 1, ""Array"": [{""Text"": ""AAAA"", ""Number"": 42}]}]}") as DeeperObjectArray_L2;
|
||||||
Assert.AreEqual(false, parser.Tainted);
|
Assert.False(parser.Tainted);
|
||||||
Assert.AreEqual("Thing", result.Name);
|
Assert.Equal("Thing", result.Name);
|
||||||
Assert.AreEqual(1, result.Objects[0].Count);
|
Assert.Equal(1, result.Objects[0].Count);
|
||||||
Assert.AreEqual("AAAA", result.Objects[0].Array[0].Text);
|
Assert.Equal("AAAA", result.Objects[0].Array[0].Text);
|
||||||
Assert.AreEqual(42, result.Objects[0].Array[0].Number);
|
Assert.Equal(42, result.Objects[0].Array[0].Number);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Parse
|
#endregion Parse
|
||||||
|
|
||||||
#region Validity tests
|
#region Validity tests
|
||||||
|
|
||||||
[TestMethod()]
|
[Fact]
|
||||||
public void Parse__Validity_Fail01()
|
public void Parse__Validity_Fail01()
|
||||||
{
|
{
|
||||||
JsonParser parser = new JsonParser();
|
JsonParser parser = new JsonParser();
|
||||||
object result = parser.Parse(@"""A JSON payload should be an object or array, not a string.""");
|
object result = parser.Parse(@"""A JSON payload should be an object or array, not a string.""");
|
||||||
Assert.AreEqual(true, parser.Tainted);
|
Assert.True(parser.Tainted);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod()]
|
[Fact]
|
||||||
public void Parse__Validity_Fail02()
|
public void Parse__Validity_Fail02()
|
||||||
{
|
{
|
||||||
JsonParser parser = new JsonParser();
|
JsonParser parser = new JsonParser();
|
||||||
object result = parser.Parse(@"[""Unclosed array""");
|
object result = parser.Parse(@"[""Unclosed array""");
|
||||||
Assert.AreEqual(true, parser.Tainted);
|
Assert.True(parser.Tainted);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod()]
|
[Fact]
|
||||||
public void Parse__Validity_Fail03()
|
public void Parse__Validity_Fail03()
|
||||||
{
|
{
|
||||||
JsonParser parser = new JsonParser();
|
JsonParser parser = new JsonParser();
|
||||||
object result = parser.Parse(@"{unquoted_key: ""keys must be quoted""}");
|
object result = parser.Parse(@"{unquoted_key: ""keys must be quoted""}");
|
||||||
Assert.AreEqual(true, parser.Tainted);
|
Assert.True(parser.Tainted);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod()]
|
[Fact]
|
||||||
public void Parse__Validity_Fail04()
|
public void Parse__Validity_Fail04()
|
||||||
{
|
{
|
||||||
JsonParser parser = new JsonParser();
|
JsonParser parser = new JsonParser();
|
||||||
object result = parser.Parse(@"[""extra comma"",]");
|
object result = parser.Parse(@"[""extra comma"",]");
|
||||||
Assert.AreEqual(true, parser.Tainted);
|
Assert.True(parser.Tainted);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod()]
|
[Fact]
|
||||||
public void Parse__Validity_Fail05()
|
public void Parse__Validity_Fail05()
|
||||||
{
|
{
|
||||||
JsonParser parser = new JsonParser();
|
JsonParser parser = new JsonParser();
|
||||||
object result = parser.Parse(@"[""double extra comma"",,]");
|
object result = parser.Parse(@"[""double extra comma"",,]");
|
||||||
Assert.AreEqual(true, parser.Tainted);
|
Assert.True(parser.Tainted);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod()]
|
[Fact]
|
||||||
public void Parse__Validity_Fail06()
|
public void Parse__Validity_Fail06()
|
||||||
{
|
{
|
||||||
JsonParser parser = new JsonParser();
|
JsonParser parser = new JsonParser();
|
||||||
object result = parser.Parse(@"[ , ""<-- missing value""]");
|
object result = parser.Parse(@"[ , ""<-- missing value""]");
|
||||||
Assert.AreEqual(true, parser.Tainted);
|
Assert.True(parser.Tainted);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod()]
|
[Fact]
|
||||||
public void Parse__Validity_Fail07()
|
public void Parse__Validity_Fail07()
|
||||||
{
|
{
|
||||||
JsonParser parser = new JsonParser();
|
JsonParser parser = new JsonParser();
|
||||||
object result = parser.Parse(@"[""Comma after the close""],");
|
object result = parser.Parse(@"[""Comma after the close""],");
|
||||||
Assert.AreEqual(true, parser.Tainted);
|
Assert.True(parser.Tainted);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod()]
|
[Fact]
|
||||||
public void Parse__Validity_Fail08()
|
public void Parse__Validity_Fail08()
|
||||||
{
|
{
|
||||||
JsonParser parser = new JsonParser();
|
JsonParser parser = new JsonParser();
|
||||||
object result = parser.Parse(@"[""Extra close""]]");
|
object result = parser.Parse(@"[""Extra close""]]");
|
||||||
Assert.AreEqual(true, parser.Tainted);
|
Assert.True(parser.Tainted);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod()]
|
[Fact]
|
||||||
public void Parse__Validity_Fail09()
|
public void Parse__Validity_Fail09()
|
||||||
{
|
{
|
||||||
JsonParser parser = new JsonParser();
|
JsonParser parser = new JsonParser();
|
||||||
object result = parser.Parse(@"{""Extra comma"": true,}");
|
object result = parser.Parse(@"{""Extra comma"": true,}");
|
||||||
Assert.AreEqual(true, parser.Tainted);
|
Assert.True(parser.Tainted);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod()]
|
[Fact]
|
||||||
public void Parse__Validity_Fail10()
|
public void Parse__Validity_Fail10()
|
||||||
{
|
{
|
||||||
JsonParser parser = new JsonParser();
|
JsonParser parser = new JsonParser();
|
||||||
object result = parser.Parse(@"{""Extra value after close"": true} ""misplaced quoted value""");
|
object result = parser.Parse(@"{""Extra value after close"": true} ""misplaced quoted value""");
|
||||||
Assert.AreEqual(true, parser.Tainted);
|
Assert.True(parser.Tainted);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod()]
|
[Fact]
|
||||||
public void Parse__Validity_Fail11()
|
public void Parse__Validity_Fail11()
|
||||||
{
|
{
|
||||||
JsonParser parser = new JsonParser();
|
JsonParser parser = new JsonParser();
|
||||||
object result = parser.Parse(@"{""Illegal expression"": 1 + 2}");
|
object result = parser.Parse(@"{""Illegal expression"": 1 + 2}");
|
||||||
Assert.AreEqual(true, parser.Tainted);
|
Assert.True(parser.Tainted);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod()]
|
[Fact]
|
||||||
public void Parse__Validity_Fail12()
|
public void Parse__Validity_Fail12()
|
||||||
{
|
{
|
||||||
JsonParser parser = new JsonParser();
|
JsonParser parser = new JsonParser();
|
||||||
object result = parser.Parse(@"{""Illegal invocation"": alert()}");
|
object result = parser.Parse(@"{""Illegal invocation"": alert()}");
|
||||||
Assert.AreEqual(true, parser.Tainted);
|
Assert.True(parser.Tainted);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod()]
|
[Fact]
|
||||||
public void Parse__Validity_Fail13()
|
public void Parse__Validity_Fail13()
|
||||||
{
|
{
|
||||||
JsonParser parser = new JsonParser();
|
JsonParser parser = new JsonParser();
|
||||||
object result = parser.Parse(@"{""Numbers cannot have leading zeroes"": 013}");
|
object result = parser.Parse(@"{""Numbers cannot have leading zeroes"": 013}");
|
||||||
Assert.AreEqual(true, parser.Tainted);
|
Assert.True(parser.Tainted);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod()]
|
[Fact]
|
||||||
public void Parse__Validity_Fail14()
|
public void Parse__Validity_Fail14()
|
||||||
{
|
{
|
||||||
JsonParser parser = new JsonParser();
|
JsonParser parser = new JsonParser();
|
||||||
object result = parser.Parse(@"{""Numbers cannot be hex"": 0x14}");
|
object result = parser.Parse(@"{""Numbers cannot be hex"": 0x14}");
|
||||||
Assert.AreEqual(true, parser.Tainted);
|
Assert.True(parser.Tainted);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod()]
|
[Fact]
|
||||||
public void Parse__Validity_Fail15()
|
public void Parse__Validity_Fail15()
|
||||||
{
|
{
|
||||||
JsonParser parser = new JsonParser();
|
JsonParser parser = new JsonParser();
|
||||||
object result = parser.Parse(@"[""Illegal backslash escape: \x15""]");
|
object result = parser.Parse(@"[""Illegal backslash escape: \x15""]");
|
||||||
Assert.AreEqual(true, parser.Tainted);
|
Assert.True(parser.Tainted);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod()]
|
[Fact]
|
||||||
public void Parse__Validity_Fail16()
|
public void Parse__Validity_Fail16()
|
||||||
{
|
{
|
||||||
JsonParser parser = new JsonParser();
|
JsonParser parser = new JsonParser();
|
||||||
object result = parser.Parse(@"[\naked]");
|
object result = parser.Parse(@"[\naked]");
|
||||||
Assert.AreEqual(true, parser.Tainted);
|
Assert.True(parser.Tainted);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod()]
|
[Fact]
|
||||||
public void Parse__Validity_Fail17()
|
public void Parse__Validity_Fail17()
|
||||||
{
|
{
|
||||||
JsonParser parser = new JsonParser();
|
JsonParser parser = new JsonParser();
|
||||||
object result = parser.Parse(@"[""Illegal backslash escape: \017""]");
|
object result = parser.Parse(@"[""Illegal backslash escape: \017""]");
|
||||||
Assert.AreEqual(true, parser.Tainted);
|
Assert.True(parser.Tainted);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod()]
|
[Fact]
|
||||||
public void Parse__Validity_Fail18()
|
public void Parse__Validity_Fail18()
|
||||||
{
|
{
|
||||||
JsonParser parser = new JsonParser();
|
JsonParser parser = new JsonParser();
|
||||||
object result = parser.Parse(@"[[[[[[[[[[[[[[[[[[[[""Too deep""]]]]]]]]]]]]]]]]]]]]");
|
object result = parser.Parse(@"[[[[[[[[[[[[[[[[[[[[""Too deep""]]]]]]]]]]]]]]]]]]]]");
|
||||||
Assert.AreEqual(true, parser.Tainted);
|
Assert.True(parser.Tainted);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod()]
|
[Fact]
|
||||||
public void Parse__Validity_Fail19()
|
public void Parse__Validity_Fail19()
|
||||||
{
|
{
|
||||||
JsonParser parser = new JsonParser();
|
JsonParser parser = new JsonParser();
|
||||||
object result = parser.Parse(@"{""Missing colon"" null}");
|
object result = parser.Parse(@"{""Missing colon"" null}");
|
||||||
Assert.AreEqual(true, parser.Tainted);
|
Assert.True(parser.Tainted);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod()]
|
[Fact]
|
||||||
public void Parse__Validity_Fail20()
|
public void Parse__Validity_Fail20()
|
||||||
{
|
{
|
||||||
JsonParser parser = new JsonParser();
|
JsonParser parser = new JsonParser();
|
||||||
object result = parser.Parse(@"{""Double colon"":: null}");
|
object result = parser.Parse(@"{""Double colon"":: null}");
|
||||||
Assert.AreEqual(true, parser.Tainted);
|
Assert.True(parser.Tainted);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod()]
|
[Fact]
|
||||||
public void Parse__Validity_Fail21()
|
public void Parse__Validity_Fail21()
|
||||||
{
|
{
|
||||||
JsonParser parser = new JsonParser();
|
JsonParser parser = new JsonParser();
|
||||||
object result = parser.Parse(@"{""Comma instead of colon"", null}");
|
object result = parser.Parse(@"{""Comma instead of colon"", null}");
|
||||||
Assert.AreEqual(true, parser.Tainted);
|
Assert.True(parser.Tainted);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod()]
|
[Fact]
|
||||||
public void Parse__Validity_Fail22()
|
public void Parse__Validity_Fail22()
|
||||||
{
|
{
|
||||||
JsonParser parser = new JsonParser();
|
JsonParser parser = new JsonParser();
|
||||||
object result = parser.Parse(@"[""Colon instead of comma"": false]");
|
object result = parser.Parse(@"[""Colon instead of comma"": false]");
|
||||||
Assert.AreEqual(true, parser.Tainted);
|
Assert.True(parser.Tainted);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod()]
|
[Fact]
|
||||||
public void Parse__Validity_Fail23()
|
public void Parse__Validity_Fail23()
|
||||||
{
|
{
|
||||||
JsonParser parser = new JsonParser();
|
JsonParser parser = new JsonParser();
|
||||||
object result = parser.Parse(@"[""Bad value"", truth]");
|
object result = parser.Parse(@"[""Bad value"", truth]");
|
||||||
Assert.AreEqual(true, parser.Tainted);
|
Assert.True(parser.Tainted);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod()]
|
[Fact]
|
||||||
public void Parse__Validity_Fail24()
|
public void Parse__Validity_Fail24()
|
||||||
{
|
{
|
||||||
JsonParser parser = new JsonParser();
|
JsonParser parser = new JsonParser();
|
||||||
object result = parser.Parse(@"['single quote']");
|
object result = parser.Parse(@"['single quote']");
|
||||||
Assert.AreEqual(true, parser.Tainted);
|
Assert.True(parser.Tainted);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod()]
|
[Fact]
|
||||||
public void Parse__Validity_Fail25()
|
public void Parse__Validity_Fail25()
|
||||||
{
|
{
|
||||||
JsonParser parser = new JsonParser();
|
JsonParser parser = new JsonParser();
|
||||||
object result = parser.Parse(@"["" tab character in string ""]");
|
object result = parser.Parse(@"["" tab character in string ""]");
|
||||||
Assert.AreEqual(true, parser.Tainted);
|
Assert.True(parser.Tainted);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod()]
|
[Fact]
|
||||||
public void Parse__Validity_Fail26()
|
public void Parse__Validity_Fail26()
|
||||||
{
|
{
|
||||||
JsonParser parser = new JsonParser();
|
JsonParser parser = new JsonParser();
|
||||||
object result = parser.Parse(@"[""tab\ character\ in\ string\ ""]");
|
object result = parser.Parse(@"[""tab\ character\ in\ string\ ""]");
|
||||||
Assert.AreEqual(true, parser.Tainted);
|
Assert.True(parser.Tainted);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod()]
|
[Fact]
|
||||||
public void Parse__Validity_Fail27()
|
public void Parse__Validity_Fail27()
|
||||||
{
|
{
|
||||||
JsonParser parser = new JsonParser();
|
JsonParser parser = new JsonParser();
|
||||||
object result = parser.Parse(@"[""line
|
object result = parser.Parse(@"[""line
|
||||||
break""]");
|
break""]");
|
||||||
Assert.AreEqual(true, parser.Tainted);
|
Assert.True(parser.Tainted);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod()]
|
[Fact]
|
||||||
public void Parse__Validity_Fail28()
|
public void Parse__Validity_Fail28()
|
||||||
{
|
{
|
||||||
JsonParser parser = new JsonParser();
|
JsonParser parser = new JsonParser();
|
||||||
object result = parser.Parse(@"[""line\
|
object result = parser.Parse(@"[""line\
|
||||||
break""]");
|
break""]");
|
||||||
Assert.AreEqual(true, parser.Tainted);
|
Assert.True(parser.Tainted);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod()]
|
[Fact]
|
||||||
public void Parse__Validity_Fail29()
|
public void Parse__Validity_Fail29()
|
||||||
{
|
{
|
||||||
JsonParser parser = new JsonParser();
|
JsonParser parser = new JsonParser();
|
||||||
object result = parser.Parse(@"[0e]");
|
object result = parser.Parse(@"[0e]");
|
||||||
Assert.AreEqual(true, parser.Tainted);
|
Assert.True(parser.Tainted);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod()]
|
[Fact]
|
||||||
public void Parse__Validity_Fail30()
|
public void Parse__Validity_Fail30()
|
||||||
{
|
{
|
||||||
JsonParser parser = new JsonParser();
|
JsonParser parser = new JsonParser();
|
||||||
object result = parser.Parse(@"[0e+]");
|
object result = parser.Parse(@"[0e+]");
|
||||||
Assert.AreEqual(true, parser.Tainted);
|
Assert.True(parser.Tainted);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod()]
|
[Fact]
|
||||||
public void Parse__Validity_Fail31()
|
public void Parse__Validity_Fail31()
|
||||||
{
|
{
|
||||||
JsonParser parser = new JsonParser();
|
JsonParser parser = new JsonParser();
|
||||||
object result = parser.Parse(@"[0e+-1]");
|
object result = parser.Parse(@"[0e+-1]");
|
||||||
Assert.AreEqual(true, parser.Tainted);
|
Assert.True(parser.Tainted);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod()]
|
[Fact]
|
||||||
public void Parse__Validity_Fail32()
|
public void Parse__Validity_Fail32()
|
||||||
{
|
{
|
||||||
JsonParser parser = new JsonParser();
|
JsonParser parser = new JsonParser();
|
||||||
object result = parser.Parse(@"{""Comma instead if closing brace"": true,");
|
object result = parser.Parse(@"{""Comma instead if closing brace"": true,");
|
||||||
Assert.AreEqual(true, parser.Tainted);
|
Assert.True(parser.Tainted);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod()]
|
[Fact]
|
||||||
public void Parse__Validity_Fail33()
|
public void Parse__Validity_Fail33()
|
||||||
{
|
{
|
||||||
JsonParser parser = new JsonParser();
|
JsonParser parser = new JsonParser();
|
||||||
object result = parser.Parse(@"[""mismatch""}");
|
object result = parser.Parse(@"[""mismatch""}");
|
||||||
Assert.AreEqual(true, parser.Tainted);
|
Assert.True(parser.Tainted);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod()]
|
[Fact]
|
||||||
public void Parse__Validity_Pass01()
|
public void Parse__Validity_Pass01()
|
||||||
{
|
{
|
||||||
JsonParser parser = new JsonParser();
|
JsonParser parser = new JsonParser();
|
||||||
@@ -449,18 +448,18 @@ break""]");
|
|||||||
1e-1,
|
1e-1,
|
||||||
1e00,2e+00,2e-00
|
1e00,2e+00,2e-00
|
||||||
,""rosebud""]");
|
,""rosebud""]");
|
||||||
Assert.AreEqual(false, parser.Tainted);
|
Assert.False(parser.Tainted);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod()]
|
[Fact]
|
||||||
public void Parse__Validity_Pass02()
|
public void Parse__Validity_Pass02()
|
||||||
{
|
{
|
||||||
JsonParser parser = new JsonParser();
|
JsonParser parser = new JsonParser();
|
||||||
object result = parser.Parse(@"[[[[[[[[[[[[[[[[[[[""Not too deep""]]]]]]]]]]]]]]]]]]]");
|
object result = parser.Parse(@"[[[[[[[[[[[[[[[[[[[""Not too deep""]]]]]]]]]]]]]]]]]]]");
|
||||||
Assert.AreEqual(false, parser.Tainted);
|
Assert.False(parser.Tainted);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod()]
|
[Fact]
|
||||||
public void Parse__Validity_Pass03()
|
public void Parse__Validity_Pass03()
|
||||||
{
|
{
|
||||||
JsonParser parser = new JsonParser();
|
JsonParser parser = new JsonParser();
|
||||||
@@ -471,7 +470,7 @@ break""]");
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
");
|
");
|
||||||
Assert.AreEqual(false, parser.Tainted);
|
Assert.False(parser.Tainted);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Validity tests
|
#endregion Validity tests
|
||||||
|
|||||||
@@ -1,36 +0,0 @@
|
|||||||
using System.Reflection;
|
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
// General Information about an assembly is controlled through the following
|
|
||||||
// set of attributes. Change these attribute values to modify the information
|
|
||||||
// associated with an assembly.
|
|
||||||
[assembly: AssemblyTitle("VAR.Json.Tests")]
|
|
||||||
[assembly: AssemblyDescription("")]
|
|
||||||
[assembly: AssemblyConfiguration("")]
|
|
||||||
[assembly: AssemblyCompany("")]
|
|
||||||
[assembly: AssemblyProduct("VAR.Json.Tests")]
|
|
||||||
[assembly: AssemblyCopyright("Copyright © 2020")]
|
|
||||||
[assembly: AssemblyTrademark("")]
|
|
||||||
[assembly: AssemblyCulture("")]
|
|
||||||
|
|
||||||
// Setting ComVisible to false makes the types in this assembly not visible
|
|
||||||
// to COM components. If you need to access a type in this assembly from
|
|
||||||
// COM, set the ComVisible attribute to true on that type.
|
|
||||||
[assembly: ComVisible(false)]
|
|
||||||
|
|
||||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
|
||||||
[assembly: Guid("b92ac920-87d7-46de-afd8-d9c5eff7debe")]
|
|
||||||
|
|
||||||
// Version information for an assembly consists of the following four values:
|
|
||||||
//
|
|
||||||
// Major Version
|
|
||||||
// Minor Version
|
|
||||||
// Build Number
|
|
||||||
// Revision
|
|
||||||
//
|
|
||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
|
||||||
// by using the '*' as shown below:
|
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
|
||||||
[assembly: AssemblyVersion("1.0.0.0")]
|
|
||||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
||||||
@@ -1,106 +1,26 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<Import Project="..\packages\MSTest.TestAdapter.2.1.1\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\packages\MSTest.TestAdapter.2.1.1\build\net45\MSTest.TestAdapter.props')" />
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<TargetFramework>net5.0</TargetFramework>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
|
||||||
<ProjectGuid>{B92AC920-87D7-46DE-AFD8-D9C5EFF7DEBE}</ProjectGuid>
|
<IsPackable>false</IsPackable>
|
||||||
<OutputType>Library</OutputType>
|
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
|
||||||
<RootNamespace>VAR.Json.Tests</RootNamespace>
|
|
||||||
<AssemblyName>VAR.Json.Tests</AssemblyName>
|
|
||||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
|
||||||
<FileAlignment>512</FileAlignment>
|
|
||||||
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
|
||||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
|
|
||||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
|
||||||
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
|
|
||||||
<IsCodedUITest>False</IsCodedUITest>
|
|
||||||
<TestProjectType>UnitTest</TestProjectType>
|
|
||||||
<TargetFrameworkProfile />
|
|
||||||
<NuGetPackageImportStamp>
|
|
||||||
</NuGetPackageImportStamp>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
|
||||||
<DebugType>full</DebugType>
|
|
||||||
<Optimize>false</Optimize>
|
|
||||||
<OutputPath>bin\Debug\</OutputPath>
|
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
|
||||||
<DebugType>pdbonly</DebugType>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
<OutputPath>bin\Release\</OutputPath>
|
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.10.0" />
|
||||||
<HintPath>..\packages\MSTest.TestFramework.2.1.1\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
|
<PackageReference Include="xunit" Version="2.4.1" />
|
||||||
</Reference>
|
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
|
||||||
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
<HintPath>..\packages\MSTest.TestFramework.2.1.1\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
</Reference>
|
</PackageReference>
|
||||||
<Reference Include="System" />
|
<PackageReference Include="coverlet.collector" Version="3.0.3">
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
</PackageReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Choose>
|
|
||||||
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
|
<ProjectReference Include="..\VAR.Json\VAR.Json.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</When>
|
|
||||||
<Otherwise />
|
|
||||||
</Choose>
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Include="JsonParser_Tests.cs" />
|
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="packages.config" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\VAR.Json\VAR.Json.csproj">
|
|
||||||
<Project>{28B3F937-145C-4FD4-A75B-A25EA4CC0428}</Project>
|
|
||||||
<Name>VAR.Json</Name>
|
|
||||||
</ProjectReference>
|
|
||||||
</ItemGroup>
|
|
||||||
<Choose>
|
|
||||||
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
|
|
||||||
<ItemGroup>
|
|
||||||
<Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
</ItemGroup>
|
|
||||||
</When>
|
|
||||||
</Choose>
|
|
||||||
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
|
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
|
||||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
|
||||||
<PropertyGroup>
|
|
||||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
|
||||||
</PropertyGroup>
|
|
||||||
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.2.1.1\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.2.1.1\build\net45\MSTest.TestAdapter.props'))" />
|
|
||||||
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.2.1.1\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.2.1.1\build\net45\MSTest.TestAdapter.targets'))" />
|
|
||||||
</Target>
|
|
||||||
<Import Project="..\packages\MSTest.TestAdapter.2.1.1\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\packages\MSTest.TestAdapter.2.1.1\build\net45\MSTest.TestAdapter.targets')" />
|
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
|
||||||
<Target Name="BeforeBuild">
|
|
||||||
</Target>
|
|
||||||
<Target Name="AfterBuild">
|
|
||||||
</Target>
|
|
||||||
-->
|
|
||||||
</Project>
|
</Project>
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<packages>
|
|
||||||
<package id="MSTest.TestAdapter" version="2.1.1" targetFramework="net461" />
|
|
||||||
<package id="MSTest.TestFramework" version="2.1.1" targetFramework="net461" />
|
|
||||||
</packages>
|
|
||||||
20
VAR.Json.sln
20
VAR.Json.sln
@@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
|||||||
# Visual Studio Version 16
|
# Visual Studio Version 16
|
||||||
VisualStudioVersion = 16.0.30330.147
|
VisualStudioVersion = 16.0.30330.147
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VAR.Json", "VAR.Json\VAR.Json.csproj", "{28B3F937-145C-4FD4-A75B-A25EA4CC0428}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VAR.Json", "VAR.Json\VAR.Json.csproj", "{28B3F937-145C-4FD4-A75B-A25EA4CC0428}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Notes", "Notes", "{4C23A421-5348-48F1-8B67-A4D43E616FDE}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Notes", "Notes", "{4C23A421-5348-48F1-8B67-A4D43E616FDE}"
|
||||||
ProjectSection(SolutionItems) = preProject
|
ProjectSection(SolutionItems) = preProject
|
||||||
@@ -11,7 +11,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Notes", "Notes", "{4C23A421
|
|||||||
README.md = README.md
|
README.md = README.md
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VAR.Json.Tests", "VAR.Json.Tests\VAR.Json.Tests.csproj", "{B92AC920-87D7-46DE-AFD8-D9C5EFF7DEBE}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VAR.Json.Tests", "VAR.Json.Tests\VAR.Json.Tests.csproj", "{0E955F4D-49A9-40BC-94F7-7E2EDB30713B}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
@@ -19,14 +19,14 @@ Global
|
|||||||
Release|Any CPU = Release|Any CPU
|
Release|Any CPU = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{28B3F937-145C-4FD4-A75B-A25EA4CC0428}.Debug|Any CPU.ActiveCfg = Debug .Net 4.6.1|Any CPU
|
{28B3F937-145C-4FD4-A75B-A25EA4CC0428}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{28B3F937-145C-4FD4-A75B-A25EA4CC0428}.Debug|Any CPU.Build.0 = Debug .Net 4.6.1|Any CPU
|
{28B3F937-145C-4FD4-A75B-A25EA4CC0428}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{28B3F937-145C-4FD4-A75B-A25EA4CC0428}.Release|Any CPU.ActiveCfg = Release .Net 4.6.1|Any CPU
|
{28B3F937-145C-4FD4-A75B-A25EA4CC0428}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{28B3F937-145C-4FD4-A75B-A25EA4CC0428}.Release|Any CPU.Build.0 = Release .Net 4.6.1|Any CPU
|
{28B3F937-145C-4FD4-A75B-A25EA4CC0428}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{B92AC920-87D7-46DE-AFD8-D9C5EFF7DEBE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{0E955F4D-49A9-40BC-94F7-7E2EDB30713B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{B92AC920-87D7-46DE-AFD8-D9C5EFF7DEBE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{0E955F4D-49A9-40BC-94F7-7E2EDB30713B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{B92AC920-87D7-46DE-AFD8-D9C5EFF7DEBE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{0E955F4D-49A9-40BC-94F7-7E2EDB30713B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{B92AC920-87D7-46DE-AFD8-D9C5EFF7DEBE}.Release|Any CPU.Build.0 = Release|Any CPU
|
{0E955F4D-49A9-40BC-94F7-7E2EDB30713B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
@echo off
|
|
||||||
|
|
||||||
:: MSBuild and tools path
|
|
||||||
if exist "%ProgramFiles%\MSBuild\14.0\bin" set PATH=%ProgramFiles%\MSBuild\14.0\bin;%PATH%
|
|
||||||
if exist "%ProgramFiles(x86)%\MSBuild\14.0\bin" set PATH=%ProgramFiles(x86)%\MSBuild\14.0\bin;%PATH%
|
|
||||||
|
|
||||||
:: NuGet
|
|
||||||
set nuget="nuget"
|
|
||||||
if exist "%~dp0..\packages\NuGet.CommandLine.3.4.3\tools\NuGet.exe" set nuget="%~dp0\..\packages\NuGet.CommandLine.3.4.3\tools\NuGet.exe"
|
|
||||||
|
|
||||||
:: Release .Net 3.5
|
|
||||||
Title Building Release .Net 3.5
|
|
||||||
msbuild VAR.Json.csproj /t:Build /p:Configuration="Release .Net 3.5" /p:Platform="AnyCPU"
|
|
||||||
|
|
||||||
:: Release .Net 4.6.1
|
|
||||||
Title Building Release .Net 4.6.1
|
|
||||||
msbuild VAR.Json.csproj /t:Build /p:Configuration="Release .Net 4.6.1" /p:Platform="AnyCPU"
|
|
||||||
|
|
||||||
:: Packing Nuget
|
|
||||||
Title Packing Nuget
|
|
||||||
%nuget% pack VAR.Json.csproj -Verbosity detailed -OutputDir "NuGet" -MSBuildVersion "14.0" -Properties Configuration="Release .Net 4.6.1" -Prop Platform=AnyCPU
|
|
||||||
|
|
||||||
title Finished
|
|
||||||
pause
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
using System.Reflection;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
[assembly: AssemblyTitle("VAR.Json")]
|
|
||||||
[assembly: AssemblyDescription(".Net library for JSON parsing")]
|
|
||||||
[assembly: AssemblyConfiguration("")]
|
|
||||||
[assembly: AssemblyCompany("VAR")]
|
|
||||||
[assembly: AssemblyProduct("VAR.Json")]
|
|
||||||
[assembly: AssemblyCopyright("Copyright © VAR 2016-2017")]
|
|
||||||
[assembly: AssemblyTrademark("")]
|
|
||||||
[assembly: AssemblyCulture("")]
|
|
||||||
[assembly: ComVisible(false)]
|
|
||||||
[assembly: Guid("28b3f937-145c-4fd4-a75b-a25ea4cc0428")]
|
|
||||||
[assembly: AssemblyVersion("1.2.0.*")]
|
|
||||||
@@ -1,84 +1,33 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<TargetFramework>netstandard2.0</TargetFramework>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
|
||||||
<ProjectGuid>{28B3F937-145C-4FD4-A75B-A25EA4CC0428}</ProjectGuid>
|
|
||||||
<OutputType>Library</OutputType>
|
<OutputType>Library</OutputType>
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||||
<RootNamespace>VAR.Json</RootNamespace>
|
<Deterministic>false</Deterministic>
|
||||||
<AssemblyName>VAR.Json</AssemblyName>
|
<IsPackable>true</IsPackable>
|
||||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||||
<FileAlignment>512</FileAlignment>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug .Net 4.6.1|AnyCPU' ">
|
<PropertyGroup>
|
||||||
<DebugSymbols>true</DebugSymbols>
|
<PackageId>VAR.Json</PackageId>
|
||||||
<DebugType>full</DebugType>
|
<Title>VAR.Json</Title>
|
||||||
<Optimize>false</Optimize>
|
<Version>1.2.1</Version>
|
||||||
<OutputPath>bin\Debug\net461</OutputPath>
|
<Description>.Net library for JSON parsing</Description>
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
<Authors>VAR</Authors>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<Company>VAR</Company>
|
||||||
<WarningLevel>4</WarningLevel>
|
<Copyright>Copyright © VAR 2016-2021</Copyright>
|
||||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
<RequireLicenseAcceptance>false</RequireLicenseAcceptance>
|
||||||
<LangVersion>6</LangVersion>
|
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
|
||||||
</PropertyGroup>
|
<PackageProjectUrl>https://github.com/Kableado/VAR.Json</PackageProjectUrl>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release .Net 4.6.1|AnyCPU' ">
|
<PackageTags>JSON;JSON Library</PackageTags>
|
||||||
<DebugType>pdbonly</DebugType>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
<OutputPath>bin\Release\net461</OutputPath>
|
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
|
||||||
<LangVersion>6</LangVersion>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug .Net 3.5|AnyCPU' ">
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
|
||||||
<DebugType>full</DebugType>
|
|
||||||
<Optimize>false</Optimize>
|
|
||||||
<OutputPath>bin\Debug\net35</OutputPath>
|
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
|
||||||
<LangVersion>6</LangVersion>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release .Net 3.5|AnyCPU' ">
|
|
||||||
<DebugType>pdbonly</DebugType>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
<OutputPath>bin\Release\net35</OutputPath>
|
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
|
||||||
<LangVersion>6</LangVersion>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="System" />
|
<Content Include="..\LICENSE.txt" Link="LICENSE.txt" Pack="true" PackagePath=""/>
|
||||||
<Reference Include="System.Core" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<Target Name="CopyPackage" AfterTargets="Pack">
|
||||||
<Compile Include="JsonParser.cs" />
|
<Copy
|
||||||
<Compile Include="JsonWriter.cs" />
|
SourceFiles="$(OutputPath)..\$(PackageId).$(PackageVersion).nupkg"
|
||||||
<Compile Include="ObjectActivator.cs" />
|
DestinationFolder="Nuget\"
|
||||||
<Compile Include="ParserContext.cs" />
|
/>
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="Build.NuGet.cmd" />
|
|
||||||
<None Include="packages.config" />
|
|
||||||
<None Include="VAR.Json.nuspec" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="Nuget\keep.txt" />
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
|
||||||
<Target Name="BeforeBuild">
|
|
||||||
</Target>
|
</Target>
|
||||||
<Target Name="AfterBuild">
|
|
||||||
</Target>
|
|
||||||
-->
|
|
||||||
</Project>
|
</Project>
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
<?xml version="1.0"?>
|
|
||||||
<package >
|
|
||||||
<metadata>
|
|
||||||
<id>$id$</id>
|
|
||||||
<version>$version$</version>
|
|
||||||
<title>$title$</title>
|
|
||||||
<authors>$author$</authors>
|
|
||||||
<owners>$author$</owners>
|
|
||||||
<licenseUrl>https://github.com/Kableado/VAR.Json/blob/master/LICENSE.txt</licenseUrl>
|
|
||||||
<projectUrl>https://github.com/Kableado/VAR.Json</projectUrl>
|
|
||||||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
|
||||||
<description>$description$</description>
|
|
||||||
<copyright>Copyright VAR 2016-2017</copyright>
|
|
||||||
<tags>JSON Library</tags>
|
|
||||||
</metadata>
|
|
||||||
<files>
|
|
||||||
<file src="bin\Release\net461\VAR.Json.dll" target="lib\net461\VAR.Json.dll" />
|
|
||||||
<file src="bin\Release\net461\VAR.Json.pdb" target="lib\net461\VAR.Json.pdb" />
|
|
||||||
<file src="bin\Release\net35\VAR.Json.dll" target="lib\net35\VAR.Json.dll" />
|
|
||||||
<file src="bin\Release\net35\VAR.Json.pdb" target="lib\net35\VAR.Json.pdb" />
|
|
||||||
</files>
|
|
||||||
</package>
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<packages>
|
|
||||||
<package id="NuGet.CommandLine" version="3.4.3" targetFramework="net461" developmentDependency="true" />
|
|
||||||
</packages>
|
|
||||||
Reference in New Issue
Block a user