diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a2118953..cf74ac60 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,7 +18,11 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v2 with: - dotnet-version: 6.0.x + dotnet-version: | + 6.0.x + 7.0.x + 8.0.x + 9.0.x - name: NuGet Restore run: dotnet restore - name: Build diff --git a/src/Reveal.Sdk.Dom.Tests/RdashDocumentFixture.cs b/src/Reveal.Sdk.Dom.Tests/RdashDocumentFixture.cs index 01df3700..f342c062 100644 --- a/src/Reveal.Sdk.Dom.Tests/RdashDocumentFixture.cs +++ b/src/Reveal.Sdk.Dom.Tests/RdashDocumentFixture.cs @@ -1,5 +1,4 @@ using Newtonsoft.Json.Linq; -using Newtonsoft.Json.Schema; using Reveal.Sdk.Dom.Core.Constants; using Reveal.Sdk.Dom.Core.Utilities; using Reveal.Sdk.Dom.Data; @@ -167,7 +166,12 @@ public void RdashDocument_Load_WithStream_ShouldLoadDocumentFromStream() public void RdashDocument_LoadFromJson_ShouldLoadDocumentFromJsonString() { // Arrange - var json = "{\"Title\":\"My Dashboard\",\"ThemeName\":\"Mountain\"}"; + var json = """ + { + "Title":"My Dashboard", + "ThemeName":"Mountain" + } + """; // Act var document = RdashDocument.LoadFromJson(json); @@ -212,19 +216,20 @@ public void RdashDocument_ToJsonString_ShouldReturnJsonStringRepresentation() { // Arrange var document = new RdashDocument(); - string expectedJson = @" + string expectedJson = """ { - ""Title"": ""New Dashboard"", - ""ThemeName"": ""rvDashboardMountainTheme"", - ""CreatedWith"": ""Reveal.Sdk.Dom"", - ""SavedWith"": """", - ""FormatVersion"": 6, - ""UseAutoLayout"": true, - ""DataSources"": [], - ""GlobalFilters"": [], - ""GlobalVariables"": [], - ""Widgets"": [] - }"; + "Title": "New Dashboard", + "ThemeName": "rvDashboardMountainTheme", + "CreatedWith": "Reveal.Sdk.Dom", + "SavedWith": "", + "FormatVersion": 6, + "UseAutoLayout": true, + "DataSources": [], + "GlobalFilters": [], + "GlobalVariables": [], + "Widgets": [] + } + """; // Act var jsonString = document.ToJsonString(); @@ -237,28 +242,6 @@ public void RdashDocument_ToJsonString_ShouldReturnJsonStringRepresentation() Assert.Equal(expectedJObject, actualJObject); } - [Fact] - public void ToJsonString_IsValidSchema() - { - var schemaJson = File.ReadAllText(Path.Combine(Environment.CurrentDirectory, "Schemas", "RdashDocument.json")); - var schema = JSchema.Parse(schemaJson); - - var dashboard = new RdashDocument() - { - Title = "New Dashboard", - Description = "This is a test dashboard", - Theme = Theme.Aurora, - Tags = "tag1,tag2,tag3" - }; - var json = dashboard.ToJsonString(); - - var jsonDocument = JObject.Parse(json); - - bool isValid = jsonDocument.IsValid(schema); - - Assert.True(isValid); - } - [Fact] public void ImportThrows_WhenDocumentIsNull() { diff --git a/src/Reveal.Sdk.Dom.Tests/Reveal.Sdk.Dom.Tests.csproj b/src/Reveal.Sdk.Dom.Tests/Reveal.Sdk.Dom.Tests.csproj index 1257f29e..f3313f39 100644 --- a/src/Reveal.Sdk.Dom.Tests/Reveal.Sdk.Dom.Tests.csproj +++ b/src/Reveal.Sdk.Dom.Tests/Reveal.Sdk.Dom.Tests.csproj @@ -1,16 +1,16 @@ - + - net6.0 + net462;net6.0;net7.0;net8.0;net9.0 false + 11.0 - - - - - + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive @@ -36,13 +36,17 @@ PreserveNewest - - PreserveNewest - + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + diff --git a/src/Reveal.Sdk.Dom.Tests/Schemas/RdashDocument.json b/src/Reveal.Sdk.Dom.Tests/Schemas/RdashDocument.json deleted file mode 100644 index 0b36da07..00000000 --- a/src/Reveal.Sdk.Dom.Tests/Schemas/RdashDocument.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "rdash-document.schema.json", - "title": "Dashboard", - "type": "object", - "additionalProperties" : false, - "properties": { - "Title": { - "required": true, - "type": "string" - }, - "Description": { - "type": "string" - }, - "ThemeName": { - "required": true, - "type": "string" - }, - "CreatedWith": { - "required": true, - "type": "string" - }, - "SavedWith": { - "required": true, - "type": "string" - }, - "FormatVersion": { - "required": true, - "type": "integer" - }, - "UseAutoLayout": { - "required": true, - "type": "boolean" - }, - "Tags": { - "type": "string" - }, - "DataSources": { - "required": true, - "type": "array", - "items": { - "type": "any" - } - }, - "GlobalFilters": { - "required": true, - "type": "array", - "items": { - "type": "any" - } - }, - "GlobalVariables": { - "required": true, - "type": "array", - "items": { - "type": "any" - } - }, - "Widgets": { - "required": true, - "type": "array", - "items": { - "type": "any" - } - } - } -} \ No newline at end of file diff --git a/src/Reveal.Sdk.Dom/Reveal.Sdk.Dom.csproj b/src/Reveal.Sdk.Dom/Reveal.Sdk.Dom.csproj index 258d8a0a..d1c8336d 100644 --- a/src/Reveal.Sdk.Dom/Reveal.Sdk.Dom.csproj +++ b/src/Reveal.Sdk.Dom/Reveal.Sdk.Dom.csproj @@ -1,7 +1,7 @@  - net462;net6.0 + net462;net6.0;net7.0;net8.0;net9.0 true true True @@ -9,10 +9,6 @@ - - all - runtime; build; native; contentfiles; analyzers - @@ -20,7 +16,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive