Skip to content

Commit 69820b3

Browse files
committed
Updates test
Moves to ExtendedFunctionalityTests Refactors to create room for more extended functionality tests
1 parent 858ef20 commit 69820b3

11 files changed

+28
-171
lines changed

test/json-ld.net.tests/SortingTests.cs renamed to test/json-ld.net.tests/ExtendedFunctionalityTests.cs

+22-22
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@
88

99
namespace JsonLD.Test
1010
{
11-
public class SortingTests
11+
public class ExtendedFunctionalityTests
1212
{
13-
[Theory, MemberData(nameof(SortingTestCases))]
14-
public void RunJsonLdApi(string id, SortingTestCase testCase)
13+
public const string ManifestRoot = "ExtendedFunctionality";
14+
15+
[Theory, MemberData(nameof(ExtendedFunctionalityCases))]
16+
public void ExtendedFunctionalityTestPasses(string id, ExtendedFunctionalityTestCase testCase)
1517
{
1618
JToken result = testCase.run();
1719
if (testCase.error != null)
@@ -37,7 +39,7 @@ public void RunJsonLdApi(string id, SortingTestCase testCase)
3739
}
3840
}
3941

40-
public class SortingTestCase
42+
public class ExtendedFunctionalityTestCase
4143
{
4244
public JToken input { get; set; }
4345
public JToken output { get; set; }
@@ -47,28 +49,33 @@ public class SortingTestCase
4749
public Func<JToken> run { get; set; }
4850
}
4951

50-
private static string[] GetManifests()
52+
public static IEnumerable<object[]> ExtendedFunctionalityCases()
5153
{
52-
return new[] {
53-
"fromRdf-manifest.jsonld",
54-
//"compact-manifest.jsonld"
55-
};
54+
foreach (var testCase in SortingTestCases())
55+
{
56+
yield return testCase;
57+
}
5658
}
5759

60+
private static string[] SortingManifests =
61+
{
62+
"fromRdf-manifest.jsonld"
63+
};
64+
5865
public static IEnumerable<object[]> SortingTestCases()
5966
{
60-
var manifests = GetManifests();
6167
var jsonFetcher = new JsonFetcher();
62-
var rootDirectory = Path.Combine("Sorting", "W3C");
63-
64-
foreach (string manifest in manifests)
68+
var rootDirectory = Path.Combine(ManifestRoot, "Sorting");
69+
var cases = new List<object[]> { };
70+
71+
foreach (string manifest in SortingManifests)
6572
{
6673
JToken manifestJson = jsonFetcher.GetJson(manifest, rootDirectory);
6774

6875
foreach (JObject testcase in manifestJson["sequence"])
6976
{
7077
Func<JToken> run = null;
71-
SortingTestCase newCase = new SortingTestCase();
78+
ExtendedFunctionalityTestCase newCase = new ExtendedFunctionalityTestCase();
7279

7380
newCase.input = jsonFetcher.GetJson(manifestJson["input"], rootDirectory);
7481
newCase.output = jsonFetcher.GetJson(testcase["expect"], rootDirectory);
@@ -102,14 +109,7 @@ public static IEnumerable<object[]> SortingTestCases()
102109

103110
var testType = (string)testcase["test-type"];
104111

105-
if (testType == "jld:Compact")
106-
{
107-
newCase.context = jsonFetcher.GetJson(manifestJson["test-context"], rootDirectory);
108-
Context activeCtx = new Context(newCase.context, options);
109-
110-
run = () => jsonLdApi.Compact(activeCtx, null, newCase.input);
111-
}
112-
else if (testType == "jld:FromRDF")
112+
if (testType == "jld:FromRDF")
113113
{
114114
JToken quads = newCase.input["quads"];
115115
RDFDataset rdf = new RDFDataset();

test/json-ld.net.tests/Sorting/W3C/compact-context.jsonld

-4
This file was deleted.

test/json-ld.net.tests/Sorting/W3C/compact-in.jsonld

-89
This file was deleted.

test/json-ld.net.tests/Sorting/W3C/compact-manifest.jsonld

-41
This file was deleted.

test/json-ld.net.tests/json-ld.net.tests.csproj

+6-15
Original file line numberDiff line numberDiff line change
@@ -28,31 +28,22 @@
2828
</ItemGroup>
2929

3030
<ItemGroup>
31-
<None Update="Sorting\W3C\compact-context.jsonld">
31+
<None Update="ExtendedFunctionality\Sorting\fromRdf-out-sort-graph-nodes.jsonld">
3232
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
3333
</None>
34-
<None Update="Sorting\W3C\compact-in.jsonld">
34+
<None Update="ExtendedFunctionality\Sorting\fromRdf-out-no-sorting.jsonld">
3535
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
3636
</None>
37-
<None Update="Sorting\W3C\compact-manifest.jsonld">
37+
<None Update="ExtendedFunctionality\Sorting\fromRdf-out-sort-graphs.jsonld">
3838
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
3939
</None>
40-
<None Update="Sorting\W3C\fromRdf-out-sort-graph-nodes.jsonld">
40+
<None Update="ExtendedFunctionality\Sorting\fromRdf-out-sort-graphs-and-nodes.jsonld">
4141
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
4242
</None>
43-
<None Update="Sorting\W3C\fromRdf-out-no-sorting.jsonld">
43+
<None Update="ExtendedFunctionality\Sorting\fromRdf-manifest.jsonld">
4444
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
4545
</None>
46-
<None Update="Sorting\W3C\fromRdf-out-sort-graphs.jsonld">
47-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
48-
</None>
49-
<None Update="Sorting\W3C\fromRdf-out-sort-graphs-and-nodes.jsonld">
50-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
51-
</None>
52-
<None Update="Sorting\W3C\fromRdf-manifest.jsonld">
53-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
54-
</None>
55-
<None Update="Sorting\W3C\fromRdf-in.json">
46+
<None Update="ExtendedFunctionality\Sorting\fromRdf-in.json">
5647
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
5748
</None>
5849
</ItemGroup>

0 commit comments

Comments
 (0)