Skip to content

Commit ae041f1

Browse files
Version 8 (#296)
* Bump github/codeql-action from 2 to 3 in the actions-deps group (#241) Bumps the actions-deps group with 1 update: [github/codeql-action](https://github.com/github/codeql-action). Updates `github/codeql-action` from 2 to 3 - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](github/codeql-action@v2...v3) --- updated-dependencies: - dependency-name: github/codeql-action dependency-type: direct:production update-type: version-update:semver-major dependency-group: actions-deps ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump the all-deps group across 1 directory with 3 updates (#244) Bumps the all-deps group with 3 updates in the / directory: [JsonSchema.Net](https://github.com/json-everything/json-everything), [System.Text.Json](https://github.com/dotnet/runtime) and [Testably.Abstractions.Testing](https://github.com/Testably/Testably.Abstractions). Updates `JsonSchema.Net` from 7.3.3 to 7.3.4 - [Commits](https://github.com/json-everything/json-everything/commits) Updates `System.Text.Json` from 9.0.2 to 9.0.0 - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](dotnet/runtime@v9.0.2...v9.0.0) Updates `System.Text.Json` from 9.0.2 to 9.0.3 - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](dotnet/runtime@v9.0.2...v9.0.0) Updates `Testably.Abstractions.Testing` from 4.0.0 to 4.0.1 - [Release notes](https://github.com/Testably/Testably.Abstractions/releases) - [Commits](Testably/Testably.Abstractions@v4.0.0...v4.0.1) --- updated-dependencies: - dependency-name: JsonSchema.Net dependency-type: direct:production update-type: version-update:semver-patch dependency-group: all-deps - dependency-name: System.Text.Json dependency-type: direct:production update-type: version-update:semver-patch dependency-group: all-deps - dependency-name: System.Text.Json dependency-type: direct:production update-type: version-update:semver-patch dependency-group: all-deps - dependency-name: Testably.Abstractions.Testing dependency-type: direct:production update-type: version-update:semver-patch dependency-group: all-deps ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump System.Text.Json from 9.0.3 to 9.0.4 in the all-deps group (#245) Bumps the all-deps group with 1 update: [System.Text.Json](https://github.com/dotnet/runtime). Updates `System.Text.Json` from 9.0.3 to 9.0.4 - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](dotnet/runtime@v9.0.3...v9.0.4) --- updated-dependencies: - dependency-name: System.Text.Json dependency-version: 9.0.4 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: all-deps ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump xunit.runner.visualstudio from 3.0.2 to 3.1.0 in the all-deps group (#246) Bumps the all-deps group with 1 update: [xunit.runner.visualstudio](https://github.com/xunit/visualstudio.xunit). Updates `xunit.runner.visualstudio` from 3.0.2 to 3.1.0 - [Release notes](https://github.com/xunit/visualstudio.xunit/releases) - [Commits](xunit/visualstudio.xunit@3.0.2...3.1.0) --- updated-dependencies: - dependency-name: xunit.runner.visualstudio dependency-version: 3.1.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: all-deps ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump the all-deps group with 2 updates (#249) Bumps Microsoft.NET.Test.Sdk from 17.13.0 to 17.14.1 Bumps System.Text.Json from 9.0.4 to 9.0.5 --- updated-dependencies: - dependency-name: Microsoft.NET.Test.Sdk dependency-version: 17.14.1 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: all-deps - dependency-name: System.Text.Json dependency-version: 9.0.5 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: all-deps ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump Microsoft.NET.Test.Sdk from 17.13.0 to 17.14.1 (#250) --- updated-dependencies: - dependency-name: Microsoft.NET.Test.Sdk dependency-version: 17.14.1 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: all-deps ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump the all-deps group with 1 update (#251) Bumps xunit.runner.visualstudio from 3.1.0 to 3.1.1 --- updated-dependencies: - dependency-name: xunit.runner.visualstudio dependency-version: 3.1.1 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: all-deps ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump the all-deps group with 1 update (#252) Bumps System.Text.Json from 9.0.5 to 9.0.6 --- updated-dependencies: - dependency-name: System.Text.Json dependency-version: 9.0.6 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: all-deps ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump the all-deps group with 1 update (#253) Bumps System.Text.Json from 9.0.6 to 9.0.7 --- updated-dependencies: - dependency-name: System.Text.Json dependency-version: 9.0.7 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: all-deps ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * update deps * Bump the actions-deps group across 1 directory with 2 updates (#258) Bumps the actions-deps group with 2 updates in the / directory: [actions/checkout](https://github.com/actions/checkout) and [actions/download-artifact](https://github.com/actions/download-artifact). Updates `actions/checkout` from 4 to 5 - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](actions/checkout@v4...v5) Updates `actions/download-artifact` from 4 to 5 - [Commits](actions/download-artifact@v4...v5) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: '5' dependency-type: direct:production update-type: version-update:semver-major dependency-group: actions-deps - dependency-name: actions/download-artifact dependency-version: '5' dependency-type: direct:production update-type: version-update:semver-major dependency-group: actions-deps ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump actions/setup-dotnet from 4 to 5 in the actions-deps group (#260) Bumps the actions-deps group with 1 update: [actions/setup-dotnet](https://github.com/actions/setup-dotnet). Updates `actions/setup-dotnet` from 4 to 5 - [Release notes](https://github.com/actions/setup-dotnet/releases) - [Commits](actions/setup-dotnet@v4...v5) --- updated-dependencies: - dependency-name: actions/setup-dotnet dependency-version: '5' dependency-type: direct:production update-type: version-update:semver-major dependency-group: actions-deps ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump System.Text.Json from 9.0.8 to 9.0.9 (#263) --- updated-dependencies: - dependency-name: System.Text.Json dependency-version: 9.0.9 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: all-deps ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump the actions-deps group across 1 directory with 4 updates (#286) Bumps the actions-deps group with 4 updates in the / directory: [actions/checkout](https://github.com/actions/checkout), [github/codeql-action](https://github.com/github/codeql-action), [actions/upload-artifact](https://github.com/actions/upload-artifact) and [actions/download-artifact](https://github.com/actions/download-artifact). Updates `actions/checkout` from 5 to 6 - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](actions/checkout@v5...v6) Updates `github/codeql-action` from 3 to 4 - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](github/codeql-action@v3...v4) Updates `actions/upload-artifact` from 4 to 5 - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](actions/upload-artifact@v4...v5) Updates `actions/download-artifact` from 5 to 6 - [Release notes](https://github.com/actions/download-artifact/releases) - [Commits](actions/download-artifact@v5...v6) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: '6' dependency-type: direct:production update-type: version-update:semver-major dependency-group: actions-deps - dependency-name: github/codeql-action dependency-version: '4' dependency-type: direct:production update-type: version-update:semver-major dependency-group: actions-deps - dependency-name: actions/upload-artifact dependency-version: '5' dependency-type: direct:production update-type: version-update:semver-major dependency-group: actions-deps - dependency-name: actions/download-artifact dependency-version: '6' dependency-type: direct:production update-type: version-update:semver-major dependency-group: actions-deps ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * update deps * update .net and migrate solution * delete * delete * add * Update deps (#295) * start updating deps * update json lib * resolve some warnings * enable test * update version --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1 parent b033492 commit ae041f1

25 files changed

Lines changed: 203 additions & 206 deletions

src/EawModinfo.Tests/DependencyListTest.cs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.IO;
4-
using System.Linq;
5-
using System.Text;
6-
using System.Text.Json.Nodes;
71
using AET.Modinfo.Model;
82
using AET.Modinfo.Model.Json;
93
using AET.Modinfo.Model.Json.Schema;
104
using AET.Modinfo.Spec;
115
using AET.Modinfo.Spec.Equality;
6+
using System;
7+
using System.Collections.Generic;
8+
using System.IO;
9+
using System.Linq;
10+
using System.Text;
11+
using System.Text.Json;
1212
using Xunit;
1313

1414
namespace AET.Modinfo.Tests;
@@ -61,35 +61,35 @@ public void Ctor_Throws()
6161

6262
public static IEnumerable<object[]> GetInvalidJsonData()
6363
{
64-
yield return ["{}", new[] { "oneOf", "type" }];
65-
yield return ["[]", new[] {"oneOf", "contains" }];
64+
yield return ["{}", new[] { "type" }];
65+
yield return ["[]", new[] { "contains" }];
6666
yield return [@"[""FullResolved""]", new[] { "contains", "type" }];
6767
yield return
6868
[
69-
@"[""NoValidResolve"", {""identifier"":""123"", ""modtype"":1}]",new[]{ "oneOf", "enum", "type" }
69+
@"[""NoValidResolve"", {""identifier"":""1"", ""modtype"":1}]",new[]{ "enum", "type" }
7070
];
7171
yield return
7272
[
73-
@"[{""identifier"":""123"" }]", new[] { "oneOf", "enum", "contains", "required" }
73+
@"[{""identifier"":""2"" }]", new[] { "enum", "contains", "required" }
7474
];
7575
yield return
7676
[
77-
@"[""FullResolved"", {""identifier"":""123"" }]", new[]{ "oneOf", "type", "contains", "required" }
77+
@"[""FullResolved"", {""identifier"":""3"" }]", new[]{ "type", "contains", "required" }
7878
];
7979
yield return
8080
[
81-
@"[null, {""identifier"":""123"", ""modtype"":1 }]", new[]{ "oneOf", "enum", "type" }
81+
@"[null, {""identifier"":""4"", ""modtype"":1 }]", new[]{ "enum", "type" }
8282
];
83-
yield return [@"[""FullResolved"", {""identifier"":""123"", ""modtype"":1}, {""other"": ""value""}]", new[] { "oneOf", "required", "", "type" }];
84-
yield return [@"[{""identifier"":""123"", ""modtype"":1}, {""other"": ""value""}]", new[] { "oneOf", "required", "", "enum" }];
83+
yield return [@"[""FullResolved"", {""identifier"":""5"", ""modtype"":1}, {""other"": ""value""}]", new[] { "required", "", "type" }];
84+
yield return [@"[{""identifier"":""6"", ""modtype"":1}, {""other"": ""value""}]", new[] { "required", "", "enum" }];
8585
}
8686

8787
[Theory]
8888
[MemberData(nameof(GetInvalidJsonData))]
8989
public void Parse_Invalid(string data, IList<string> expectedErrorKeys)
9090
{
91-
Assert.False(ModInfoJsonSchema.IsValid(JsonNode.Parse(data), EvaluationType.ModDependencyList, out var errors));
92-
Assert.Equivalent(expectedErrorKeys, Enumerable.Select<KeyValuePair<string, string>, string>(errors, x => x.Key).Distinct(), true);
91+
Assert.False(ModInfoJsonSchema.IsValid(JsonElement.Parse(data), EvaluationType.ModDependencyList, out var errors));
92+
Assert.Equivalent(expectedErrorKeys, errors.Select<KeyValuePair<string, string>, string>(x => x.Key).Distinct(), true);
9393
Assert.Throws<ModinfoParseException>(() => TestUtilities.Evaluate(data, EvaluationType.ModDependencyList));
9494
Assert.Throws<ModinfoParseException>((Func<object?>)(() => DependencyList.Parse(data)));
9595
Assert.Throws<ModinfoParseException>((Func<object?>)(() => DependencyList.Parse(new MemoryStream(Encoding.UTF8.GetBytes(data)))));
@@ -134,7 +134,7 @@ public static IEnumerable<object[]> GetJsonData()
134134
[MemberData(nameof(GetJsonData))]
135135
public void Parse(string data, IList<IModReference>? refs, DependencyResolveLayout? resolveLayout)
136136
{
137-
Assert.True(ModInfoJsonSchema.IsValid(JsonNode.Parse(data), EvaluationType.ModDependencyList, out _));
137+
Assert.True(ModInfoJsonSchema.IsValid(JsonElement.Parse(data), EvaluationType.ModDependencyList, out _));
138138
TestUtilities.Evaluate(data, EvaluationType.ModDependencyList);
139139
var depList = DependencyList.Parse(data);
140140
Assert.Equal(refs, depList);

src/EawModinfo.Tests/EawModinfo.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<AssemblyName>AET.Modinfo.Tests</AssemblyName>
55
<RootNamespace>AET.Modinfo.Tests</RootNamespace>
66
<TargetFrameworks>net10.0</TargetFrameworks>
7-
<TargetFrameworks Condition="!$([MSBuild]::IsOsUnixLike())">$(TargetFrameworks);net48</TargetFrameworks>
7+
<TargetFrameworks Condition="!$([MSBuild]::IsOsUnixLike())">$(TargetFrameworks);net481</TargetFrameworks>
88
<IsPackable>false</IsPackable>
99
<IsTestable>true</IsTestable>
1010
</PropertyGroup>

src/EawModinfo.Tests/LanguageInfoTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
using System.Linq;
66
using System.Runtime.InteropServices;
77
using System.Text;
8-
using System.Text.Json.Nodes;
8+
using System.Text.Json;
99
using AET.Modinfo.Model;
1010
using AET.Modinfo.Model.Json;
1111
using AET.Modinfo.Model.Json.Schema;
@@ -128,7 +128,7 @@ public static IEnumerable<object[]> GetJsonData()
128128
public void Parse(string data, string expectedCode, LanguageSupportLevel expectedLevel)
129129
{
130130
TestUtilities.Evaluate(data, EvaluationType.ModLanguageInfo);
131-
Assert.True(ModInfoJsonSchema.IsValid(JsonNode.Parse(data), EvaluationType.ModLanguageInfo, out _));
131+
Assert.True(ModInfoJsonSchema.IsValid(JsonElement.Parse(data), EvaluationType.ModLanguageInfo, out _));
132132
var languageInfo = LanguageInfo.Parse(data);
133133
Assert.Equal(expectedCode, (string?)languageInfo.Code);
134134
Assert.Equal(expectedLevel, languageInfo.Support);
@@ -199,8 +199,8 @@ public static IEnumerable<object[]> GetInvalidData()
199199
public void Parse_InvalidDataThrows(string data, IList<string> expectedErrorKeys)
200200
{
201201
Assert.Throws<ModinfoParseException>(() => TestUtilities.Evaluate(data, EvaluationType.ModLanguageInfo));
202-
Assert.False(ModInfoJsonSchema.IsValid(JsonNode.Parse(data), EvaluationType.ModLanguageInfo, out var errors));
203-
Assert.Equivalent(expectedErrorKeys, Enumerable.Select<KeyValuePair<string, string>, string>(errors, x => x.Key), true);
202+
Assert.False(ModInfoJsonSchema.IsValid(JsonElement.Parse(data), EvaluationType.ModLanguageInfo, out var errors));
203+
Assert.Equivalent(expectedErrorKeys, errors.Select<KeyValuePair<string, string>, string>(x => x.Key), true);
204204
Assert.Throws<ModinfoParseException>((Func<object?>)(() => LanguageInfo.Parse(data)));
205205
Assert.Throws<ModinfoParseException>((Func<object?>)(() => LanguageInfo.Parse(new MemoryStream(Encoding.UTF8.GetBytes(data)))));
206206
}

src/EawModinfo.Tests/MergeTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public void MergeInto_VariantDefinesNameOnly()
4040
Assert.Equal((string?)mainData.Summary, (string?)newData.Summary);
4141
Assert.Equal(2, newData.Languages.Count); // As stated by the specification in III.3.2, languages was not explicitly set.
4242
Assert.True(newData.LanguagesExplicitlySet);
43-
Assert.Equal(LanguageInfo.Default, Enumerable.First(newData.Languages));
43+
Assert.Equal(LanguageInfo.Default, newData.Languages.First());
4444
Assert.Equal(2, newData.Dependencies.Count);
4545
Assert.Equal((string?)"bla", (string?)newData.Dependencies[0].Identifier);
4646
Assert.NotNull(newData.SteamData);

src/EawModinfo.Tests/ModIdentityEqualityTestsBase.cs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ public void Equal_GetHashCode_Default()
2222
var diffListVer = CreateT("A", EqualityTestHelpers.AllDifferent, EqualityTestHelpers.OtherVersion);
2323
var insensitiveName = CreateT("a", EqualityTestHelpers.List, EqualityTestHelpers.Version);
2424

25-
EqualityTestHelpers.AssertWithComparer(true, comparer, default, default);
26-
EqualityTestHelpers.AssertWithComparer(false, comparer, data, default);
27-
EqualityTestHelpers.AssertWithComparer(false, comparer, default, data);
25+
EqualityTestHelpers.AssertWithComparer(true, comparer, null, null);
26+
EqualityTestHelpers.AssertWithComparer(false, comparer, data, null);
27+
EqualityTestHelpers.AssertWithComparer(false, comparer, null, data);
2828

2929
EqualityTestHelpers.AssertWithComparer(true, comparer, data, data);
3030
EqualityTestHelpers.AssertWithComparer(true, comparer, data, sameish);
@@ -47,9 +47,9 @@ public void Equal_GetHashCode_VersionIndependent()
4747
var diffListVer = CreateT("A", EqualityTestHelpers.AllDifferent, EqualityTestHelpers.OtherVersion);
4848
var insensitiveName = CreateT("a", EqualityTestHelpers.List, EqualityTestHelpers.Version);
4949

50-
EqualityTestHelpers.AssertWithComparer(true, comparer, default, default);
51-
EqualityTestHelpers.AssertWithComparer(false, comparer, data, default);
52-
EqualityTestHelpers.AssertWithComparer(false, comparer, default, data);
50+
EqualityTestHelpers.AssertWithComparer(true, comparer, null, null);
51+
EqualityTestHelpers.AssertWithComparer(false, comparer, data, null);
52+
EqualityTestHelpers.AssertWithComparer(false, comparer, null, data);
5353

5454
EqualityTestHelpers.AssertWithComparer(true, comparer, data, data);
5555
EqualityTestHelpers.AssertWithComparer(true, comparer, data, sameish);
@@ -72,9 +72,9 @@ public void Equal_GetHashCode_DependenciesIndependent()
7272
var diffListVer = CreateT("A", EqualityTestHelpers.AllDifferent, EqualityTestHelpers.OtherVersion);
7373
var insensitiveName = CreateT("a", EqualityTestHelpers.List, EqualityTestHelpers.Version);
7474

75-
EqualityTestHelpers.AssertWithComparer(true, comparer, default, default);
76-
EqualityTestHelpers.AssertWithComparer(false, comparer, data, default);
77-
EqualityTestHelpers.AssertWithComparer(false, comparer, default, data);
75+
EqualityTestHelpers.AssertWithComparer(true, comparer, null, null);
76+
EqualityTestHelpers.AssertWithComparer(false, comparer, data, null);
77+
EqualityTestHelpers.AssertWithComparer(false, comparer, null, data);
7878

7979
EqualityTestHelpers.AssertWithComparer(true, comparer, data, data);
8080
EqualityTestHelpers.AssertWithComparer(true, comparer, data, sameish);
@@ -97,9 +97,9 @@ public void Equal_GetHashCode_VersionAndDependenciesIndependent()
9797
var diffListVer = CreateT("A", EqualityTestHelpers.AllDifferent, EqualityTestHelpers.OtherVersion);
9898
var insensitiveName = CreateT("a", EqualityTestHelpers.List, EqualityTestHelpers.Version);
9999

100-
EqualityTestHelpers.AssertWithComparer(true, comparer, default, default);
101-
EqualityTestHelpers.AssertWithComparer(false, comparer, data, default);
102-
EqualityTestHelpers.AssertWithComparer(false, comparer, default, data);
100+
EqualityTestHelpers.AssertWithComparer(true, comparer, null, null);
101+
EqualityTestHelpers.AssertWithComparer(false, comparer, data, null);
102+
EqualityTestHelpers.AssertWithComparer(false, comparer, null, data);
103103

104104
EqualityTestHelpers.AssertWithComparer(true, comparer, data, data);
105105
EqualityTestHelpers.AssertWithComparer(true, comparer, data, sameish);
@@ -122,9 +122,9 @@ public void Equal_GetHashCode_IdNameCaseInsensitive()
122122
var diffListVer = CreateT("A", EqualityTestHelpers.AllDifferent, EqualityTestHelpers.OtherVersion);
123123
var insensitiveName = CreateT("a", EqualityTestHelpers.List, EqualityTestHelpers.Version);
124124

125-
EqualityTestHelpers.AssertWithComparer(true, comparer, default, default);
126-
EqualityTestHelpers.AssertWithComparer(false, comparer, data, default);
127-
EqualityTestHelpers.AssertWithComparer(false, comparer, default, data);
125+
EqualityTestHelpers.AssertWithComparer(true, comparer, null, null);
126+
EqualityTestHelpers.AssertWithComparer(false, comparer, data, null);
127+
EqualityTestHelpers.AssertWithComparer(false, comparer, null, data);
128128

129129
EqualityTestHelpers.AssertWithComparer(true, comparer, data, data);
130130
EqualityTestHelpers.AssertWithComparer(true, comparer, data, sameish);
Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Text.Json;
23
using AET.Modinfo.Model;
34
using AET.Modinfo.Model.Json.Schema;
45
using AET.Modinfo.Spec;
@@ -12,16 +13,16 @@ public class ModInfoJsonSchemaTest
1213
[Fact]
1314
public void RunTests()
1415
{
15-
Assert.Throws<ArgumentOutOfRangeException>(() => ModInfoJsonSchema.Evaluate<IModReference>("{}"));
16-
Assert.Throws<ArgumentOutOfRangeException>(() => ModInfoJsonSchema.Evaluate<IModinfo>("{}"));
17-
Assert.Throws<ArgumentOutOfRangeException>(() => ModInfoJsonSchema.Evaluate<IModDependencyList>("{}"));
18-
Assert.Throws<ArgumentOutOfRangeException>(() => ModInfoJsonSchema.Evaluate<ISteamData>("{}"));
19-
Assert.Throws<ArgumentOutOfRangeException>(() => ModInfoJsonSchema.Evaluate<ILanguageInfo>("{}"));
16+
Assert.Throws<ArgumentOutOfRangeException>(() => ModInfoJsonSchema.Evaluate<IModReference>(JsonElement.Parse("{}")));
17+
Assert.Throws<ArgumentOutOfRangeException>(() => ModInfoJsonSchema.Evaluate<IModinfo>(JsonElement.Parse("{}")));
18+
Assert.Throws<ArgumentOutOfRangeException>(() => ModInfoJsonSchema.Evaluate<IModDependencyList>(JsonElement.Parse("{}")));
19+
Assert.Throws<ArgumentOutOfRangeException>(() => ModInfoJsonSchema.Evaluate<ISteamData>(JsonElement.Parse("{}")));
20+
Assert.Throws<ArgumentOutOfRangeException>(() => ModInfoJsonSchema.Evaluate<ILanguageInfo>(JsonElement.Parse("{}")));
2021

21-
Assert.Throws<ArgumentOutOfRangeException>(() => ModInfoJsonSchema.Evaluate<ModReference>("{}"));
22-
Assert.Throws<ArgumentOutOfRangeException>(() => ModInfoJsonSchema.Evaluate<ModinfoData>("{}"));
23-
Assert.Throws<ArgumentOutOfRangeException>(() => ModInfoJsonSchema.Evaluate<DependencyList>("{}"));
24-
Assert.Throws<ArgumentOutOfRangeException>(() => ModInfoJsonSchema.Evaluate<SteamData>("{}"));
25-
Assert.Throws<ArgumentOutOfRangeException>(() => ModInfoJsonSchema.Evaluate<LanguageInfo>("{}"));
22+
Assert.Throws<ArgumentOutOfRangeException>(() => ModInfoJsonSchema.Evaluate<ModReference>(JsonElement.Parse("{}")));
23+
Assert.Throws<ArgumentOutOfRangeException>(() => ModInfoJsonSchema.Evaluate<ModinfoData>(JsonElement.Parse("{}")));
24+
Assert.Throws<ArgumentOutOfRangeException>(() => ModInfoJsonSchema.Evaluate<DependencyList>(JsonElement.Parse("{}")));
25+
Assert.Throws<ArgumentOutOfRangeException>(() => ModInfoJsonSchema.Evaluate<SteamData>(JsonElement.Parse("{}")));
26+
Assert.Throws<ArgumentOutOfRangeException>(() => ModInfoJsonSchema.Evaluate<LanguageInfo>(JsonElement.Parse("{}")));
2627
}
2728
}

src/EawModinfo.Tests/ModReferenceBuilderTest.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public void CreateVirtualModIdentifier_ThrowsArgumentNullException_WhenModinfoIs
6767
modPath,
6868
locationKind,
6969
mainModinfoState,
70-
new[] {"variant1"},// one variants
70+
new[] {"variant1"},// one variant
7171
Array.Empty<string>(),
7272
expectedIdentifier
7373
];
@@ -152,7 +152,7 @@ public void CreateIdentifiers_NoModinfoFiles_ReturnsCorrectIdentifier(
152152

153153
var modinfoFinderCollection = new ModinfoFinderCollection(modDirectory, null, new List<ModinfoVariantFile>());
154154

155-
var modReferences = Enumerable.ToList(ModReferenceBuilder.CreateIdentifiers(modinfoFinderCollection, locationKind));
155+
var modReferences = ModReferenceBuilder.CreateIdentifiers(modinfoFinderCollection, locationKind).ToList();
156156

157157
var modRef = Assert.Single(modReferences);
158158
if (locationKind is ModReferenceBuilder.ModLocationKind.External)
@@ -179,7 +179,7 @@ public void CreateIdentifiers_OnlySingleVariant_ReturnsCorrectIdentifier(
179179
CreateValidVariantFile(modDirectory, "VariantName")
180180
});
181181

182-
var modReferences = Enumerable.ToList(ModReferenceBuilder.CreateIdentifiers(modinfoFinderCollection, locationKind));
182+
var modReferences = ModReferenceBuilder.CreateIdentifiers(modinfoFinderCollection, locationKind).ToList();
183183

184184
var modRef = Assert.Single(modReferences);
185185
Assert.Equal((string?)$"{expectedIdentifier}:VariantName", (string?)modRef.ModReference.Identifier);
@@ -213,12 +213,12 @@ public void CreateIdentifiers_TestScenario(
213213

214214
// Simulate the creation of variant files
215215
var variantFiles = validVariants.Select(x => CreateValidVariantFile(modDir, x))
216-
.Concat(malformedVariants.Select(x => CreateInvalidVariantFile(modDir)))
216+
.Concat(malformedVariants.Select(_ => CreateInvalidVariantFile(modDir)))
217217
.ToList();
218218

219219
var modinfoFinderResult = new ModinfoFinderCollection(modDir, mainModinfo, variantFiles);
220220

221-
var result = Enumerable.ToList(ModReferenceBuilder.CreateIdentifiers(modinfoFinderResult, locationKind));
221+
var result = ModReferenceBuilder.CreateIdentifiers(modinfoFinderResult, locationKind).ToList();
222222

223223
var expectedResults = new List<(string Identifier, ModType Type, string? Name)>();
224224

src/EawModinfo.Tests/ModReferenceTest.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.IO;
4-
using System.Linq;
5-
using System.Text;
6-
using System.Text.Json.Nodes;
71
using AET.Modinfo.Model;
82
using AET.Modinfo.Model.Json;
93
using AET.Modinfo.Model.Json.Schema;
104
using AET.Modinfo.Spec;
115
using AET.Modinfo.Spec.Equality;
126
using Semver;
7+
using System;
8+
using System.Collections.Generic;
9+
using System.IO;
10+
using System.Linq;
11+
using System.Text;
12+
using System.Text.Json;
1313
using Xunit;
1414

1515
namespace AET.Modinfo.Tests;
@@ -174,8 +174,8 @@ public static IEnumerable<object[]> GetInvalidJsonData()
174174
[MemberData(nameof(GetInvalidJsonData))]
175175
public void Parse_Throws(string data, IList<string> expectedErrorKeys)
176176
{
177-
Assert.False(ModInfoJsonSchema.IsValid(JsonNode.Parse(data), EvaluationType.ModReference, out var errors));
178-
Assert.Equivalent(expectedErrorKeys, Enumerable.Select<KeyValuePair<string, string>, string>(errors, x => x.Key), true);
177+
Assert.False(ModInfoJsonSchema.IsValid(JsonElement.Parse(data), EvaluationType.ModReference, out var errors));
178+
Assert.Equivalent(expectedErrorKeys, errors.Select<KeyValuePair<string, string>, string>(x => x.Key), true);
179179

180180
Assert.Throws<ModinfoParseException>(() => TestUtilities.Evaluate(data, EvaluationType.ModReference));
181181
Assert.Throws<ModinfoParseException>((Func<object?>)(() => ModReference.Parse(data)));
@@ -199,7 +199,7 @@ public static IEnumerable<object[]> GetJsonData()
199199
[MemberData(nameof(GetJsonData))]
200200
public void Parse(string data, string? expectedId, ModType? expectedType)
201201
{
202-
Assert.True(ModInfoJsonSchema.IsValid(JsonNode.Parse(data), EvaluationType.ModReference, out _));
202+
Assert.True(ModInfoJsonSchema.IsValid(JsonElement.Parse(data), EvaluationType.ModReference, out _));
203203
TestUtilities.Evaluate(data, EvaluationType.ModReference);
204204
var modReference = ModReference.Parse(data);
205205
Assert.Equal(expectedId, (string?)modReference.Identifier);

0 commit comments

Comments
 (0)