Skip to content

Commit

Permalink
Merge pull request #712 from Lombiq/issue/OSOE-795
Browse files Browse the repository at this point in the history
OSOE-795:   Upgrade to latest OC preview to test System.Text.Json
  • Loading branch information
dministro authored May 16, 2024
2 parents fa544ba + 90cc932 commit 573d3f6
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 11 deletions.
1 change: 1 addition & 0 deletions NuGet.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<configuration>
<packageSources>
<!-- Here, so the Visual Studio package manager won't default to the next feed below. -->
<clear />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="OrchardCorePreview" value="https://nuget.cloudsmith.io/orchardcore/preview/v3/index.json" />
</packageSources>
Expand Down
8 changes: 4 additions & 4 deletions src/Lombiq.OSOCE.Web/Lombiq.OSOCE.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="OrchardCore.Admin.Abstractions" Version="1.8.2" />
<PackageReference Include="OrchardCore.Application.Cms.Targets" Version="1.8.2" />
<PackageReference Include="OrchardCore.Logging.NLog" Version="1.8.2" />
<PackageReference Include="SixLabors.ImageSharp.Web" Version="3.1.0" />
<PackageReference Include="OrchardCore.Admin.Abstractions" Version="2.0.0-preview-18200" />
<PackageReference Include="OrchardCore.Application.Cms.Targets" Version="2.0.0-preview-18200" />
<PackageReference Include="OrchardCore.Logging.NLog" Version="2.0.0-preview-18200" />
<PackageReference Include="SixLabors.ImageSharp.Web" Version="3.1.2" />
</ItemGroup>

</Project>
7 changes: 6 additions & 1 deletion src/Lombiq.OSOCE.Web/Recipes/Lombiq.OSOCE.Tests.recipe.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"Lombiq.Hosting.Tenants.MediaStorageManagement",
"OrchardCore.Media",
"OrchardCore.Feature",
"OrchardCore.Email.Smtp",
"TheTheme"
// Not enabling Lombiq.TrainingDemo.Middlewares because that would write to the error log on every request.
]
Expand Down Expand Up @@ -91,8 +92,12 @@
"name": "settings",
// CDN should be turned off for tests, just as no other external resource should be used.
"UseCdn": false,
// A breaking change as of OC 1.9, the SMTP e-mail provider is not turned on by default and has to be enabled.
// Also host is null by default, so has to be explicitly specified.
"SmtpSettings": {
"DefaultSender": "[email protected]"
"IsEnabled": true,
"DefaultSender": "[email protected]",
"Host": "localhost"
},
// To make sure that e.g. numbers and dates are formatted the same way on all machines we have to specify the
// culture too.
Expand Down
Binary file added src/Lombiq.OSOCE.Web/wwwroot/favicon.ico
Binary file not shown.
8 changes: 4 additions & 4 deletions src/Modules/Lombiq.OSOCE.Samples/Lombiq.OSOCE.Samples.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="OrchardCore.Module.Targets" Version="1.8.2" />
<PackageReference Include="OrchardCore.ContentManagement" Version="1.8.2" />
<PackageReference Include="OrchardCore.ContentTypes.Abstractions" Version="1.8.2" />
<PackageReference Include="OrchardCore.DisplayManagement" Version="1.8.2" />
<PackageReference Include="OrchardCore.Module.Targets" Version="2.0.0-preview-18200" />
<PackageReference Include="OrchardCore.ContentManagement" Version="2.0.0-preview-18200" />
<PackageReference Include="OrchardCore.ContentTypes.Abstractions" Version="2.0.0-preview-18200" />
<PackageReference Include="OrchardCore.DisplayManagement" Version="2.0.0-preview-18200" />
</ItemGroup>

<ItemGroup>
Expand Down
3 changes: 2 additions & 1 deletion test/Lombiq.OSOCE.Tests.UI/Helpers/AssertAppLogsHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ public static async Task OsoceLogsShouldBeEmptyAsync(
!message.Contains("|Lombiq.TrainingDemo.Services.DemoBackgroundTask|ERROR|Expected non-error") &&
!message.Contains("OrchardCore.Media.Core.DefaultMediaFileStoreCacheFileProvider|ERROR|Error deleting cache folder"));

filteredLogOutput.ShouldNotContain(item => item.Contains("|ERROR|") || item.Contains("|FATAL|"));
var errors = filteredLogOutput.Where(item => item.Contains("|ERROR|") || item.Contains("|FATAL|"));
errors.ShouldBeEmpty();
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using Lombiq.ChartJs.Models;
using Lombiq.ChartJs.Tests.UI.Extensions;
using Shouldly;
using System.Text.Json;
using System.Threading.Tasks;
using Xunit;
using Xunit.Abstractions;
Expand All @@ -15,4 +18,26 @@ public BehaviorChartJsTests(ITestOutputHelper testOutputHelper)
[Fact]
public Task RecipeDataShouldBeDisplayedCorrectly() =>
ExecuteTestAfterSetupAsync(context => context.TestChartJsSampleBehaviorAsync());

[Fact]
public void DataLabelAlignmentConfigurationShouldSerializeCorrectly()
{
var data = new DataLabelAlignmentConfiguration
{
Align = DataLabelAlignment.Start,
Anchor = DataLabelAlignment.Center,
Font = new DataLabelAlignmentConfiguration.FontStyle { IsBold = true, Size = 16.5 },
Offset = 3.14,
};

var json = JsonSerializer.Serialize(data);
json.ShouldBe("{\"align\":\"start\",\"anchor\":\"center\",\"offset\":3.14,\"font\":{\"size\":16.5,\"weight\":\"bold\"}}");

var deserialized = JsonSerializer.Deserialize<DataLabelAlignmentConfiguration>(json);
deserialized.Align.ShouldBe(data.Align);
deserialized.Anchor.ShouldBe(data.Anchor);
deserialized.Font.IsBold.ShouldBe(data.Font.IsBold);
deserialized.Font.Size.ShouldBe(data.Font.Size);
deserialized.Offset.ShouldBe(data.Offset);
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 573d3f6

Please sign in to comment.