Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,8 @@ Because JsonDocumentPath is using the same Json.net strategic for parsing and ev
- [x] JPathParseTests
- [x] QueryExpressionTests
- [x] JPathExecuteTests
- [x] JsonNodeParseTests
- [x] JsonNodePathExecuteTests
- [x] JsonNodeQueryExpressionTests
- [x] JsonNodeRefTests

7 changes: 4 additions & 3 deletions src/JsonDocumentPath.Test/JPathExecuteTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public void GreaterThanIssue1518()
Assert.Equal(jObj, aa);

var bb = jObj.SelectElement("$..[?(@.usingmem>27000)]");//null, 27,000

Assert.Equal(jObj, bb);

var cc = jObj.SelectElement("$..[?(@.usingmem>21437)]");//found, 21,437
Expand Down Expand Up @@ -1201,13 +1202,12 @@ public void QueryAgainstNonStringValues()
/*
Dotnet 6.0 JsonDocument Parse the TimeSpan as string '365.23:59:59'
*/
#if NET6_0
#if NET6_0_OR_GREATER

Assert.Equal(2, t.Count);
#else
Assert.Equal(1, t.Count);
#endif

}

[Fact]
Expand Down Expand Up @@ -1431,6 +1431,7 @@ public void RootInFilterWithRootObject()
}

public const string IsoDateFormat = "yyyy-MM-ddTHH:mm:ss.FFFFFFFK";

[Fact]
public void RootInFilterWithInitializers()
{
Expand Down
17 changes: 16 additions & 1 deletion src/JsonDocumentPath.Test/JsonDocumentExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Text.Json;
using System.Text.Json.Nodes;

namespace JDocument.Test
{
Expand All @@ -25,4 +26,18 @@ public static bool DeepEquals(this JsonDocument left, JsonDocument? right)
return DeepEquals(left.RootElement, right?.RootElement);
}
}
}

public static class JsonNodeExtensions
{
public static bool DeepEquals(this JsonNode left, JsonNode? right)
{
if (right == null)
{
return false;
}
var jsonString = left.ToJsonString();
var jsonStringR = right.ToJsonString();
return jsonString == jsonStringR;
}
}
}
5 changes: 3 additions & 2 deletions src/JsonDocumentPath.Test/JsonDocumentPath.Test.csproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFrameworks>net6.0;</TargetFrameworks>

<IsPackable>false</IsPackable>
<LangVersion>latest</LangVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
Loading