Skip to content

Commit

Permalink
Merge pull request #98 from RevealBi/additional-frameworks
Browse files Browse the repository at this point in the history
added support for newer version of .net core
  • Loading branch information
brianlagunas authored Nov 22, 2024
2 parents 1b91e31 + d303b4d commit da39000
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 120 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
55 changes: 19 additions & 36 deletions src/Reveal.Sdk.Dom.Tests/RdashDocumentFixture.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand All @@ -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()
{
Expand Down
24 changes: 14 additions & 10 deletions src/Reveal.Sdk.Dom.Tests/Reveal.Sdk.Dom.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0</TargetFrameworks>
<TargetFrameworks>net462;net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
<IsPackable>false</IsPackable>
<LangVersion>11.0</LangVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.2.0" />
<PackageReference Include="Moq" Version="4.18.1" />
<PackageReference Include="Newtonsoft.Json.Schema" Version="3.0.14" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="Moq" Version="4.20.72" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand All @@ -36,13 +36,17 @@
<None Update="Dashboards\Sales.rdash">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Schemas\RdashDocument.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

<ItemGroup>
<Folder Include="Dashboards\" />
</ItemGroup>

<ItemGroup>
<PackageReference Update="Nerdbank.GitVersioning" Version="3.6.146">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

</Project>
67 changes: 0 additions & 67 deletions src/Reveal.Sdk.Dom.Tests/Schemas/RdashDocument.json

This file was deleted.

8 changes: 2 additions & 6 deletions src/Reveal.Sdk.Dom/Reveal.Sdk.Dom.csproj
Original file line number Diff line number Diff line change
@@ -1,26 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net462;net6.0</TargetFrameworks>
<TargetFrameworks>net462;net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
<IsPackable>true</IsPackable>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
</PropertyGroup>

<ItemGroup Condition=" $(TargetFramework) == 'net462' ">
<PackageReference Include="System.IO.Compression" Version="4.3.0" />
<PackageReference Include="Microsoft.Net.Compilers.Toolset" Version="4.6.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>

<ItemGroup>
<PackageReference Update="Nerdbank.GitVersioning" Version="3.6.133">
<PackageReference Update="Nerdbank.GitVersioning" Version="3.6.146">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down

0 comments on commit da39000

Please sign in to comment.