From f73a7a422baa5666ab030d551fb49c2fb72167fd Mon Sep 17 00:00:00 2001 From: Bruno Massa Date: Fri, 8 Mar 2024 11:37:53 -0500 Subject: [PATCH 1/3] feat: use sdk:8.0-bookworm-slim image for faster build --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4455a82..65a0a99 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,4 +1,4 @@ -image: mcr.microsoft.com/dotnet/sdk:8.0 +image: mcr.microsoft.com/dotnet/sdk:8.0-bookworm-slim stages: - build-test -- GitLab From 0f41d16bb9d4925789f92a15bec7ae7e4384d2b8 Mon Sep 17 00:00:00 2001 From: Bruno Massa Date: Fri, 8 Mar 2024 11:48:58 -0500 Subject: [PATCH 2/3] feat: update packages --- source/SuCoS.csproj | 8 ++++---- test/test.csproj | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/source/SuCoS.csproj b/source/SuCoS.csproj index 5afe94d..6b90744 100644 --- a/source/SuCoS.csproj +++ b/source/SuCoS.csproj @@ -14,16 +14,16 @@ - - + + - + - + \ No newline at end of file diff --git a/test/test.csproj b/test/test.csproj index 4e69d14..c557413 100644 --- a/test/test.csproj +++ b/test/test.csproj @@ -9,12 +9,12 @@ - + - - + + runtime; build; native; contentfiles; analyzers; buildtransitive all -- GitLab From fb5cde4c5c50c2a74ee65e6b60ce67ff9fe6d0a2 Mon Sep 17 00:00:00 2001 From: Bruno Massa Date: Fri, 8 Mar 2024 11:49:11 -0500 Subject: [PATCH 3/3] fix: make tests run in Windows --- test/Helpers/UrlizerTests.cs | 4 ++-- test/Models/FrontMatterTests.cs | 2 +- test/Models/PageTests.cs | 5 ++++- test/ServerHandlers/PingRequestHandlerTests.cs | 1 - 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/test/Helpers/UrlizerTests.cs b/test/Helpers/UrlizerTests.cs index e1e8e7e..ad6d42f 100644 --- a/test/Helpers/UrlizerTests.cs +++ b/test/Helpers/UrlizerTests.cs @@ -8,7 +8,7 @@ public class UrlizerTests [Theory] [InlineData(null)] [InlineData("")] - public void Urlize_NullOrEmptyText_ThrowsArgumentNullException(string text) + public void Urlize_NullOrEmptyText_ThrowsArgumentNullException(string? text) { var result = Urlizer.Urlize(text); Assert.Equal("", result); @@ -17,7 +17,7 @@ public class UrlizerTests [Theory] [InlineData(null)] [InlineData("")] - public void UrlizePath_NullPath_ReturnsEmptyString(string path) + public void UrlizePath_NullPath_ReturnsEmptyString(string? path) { var result = Urlizer.UrlizePath(path); diff --git a/test/Models/FrontMatterTests.cs b/test/Models/FrontMatterTests.cs index 5412e1d..bb33cdd 100644 --- a/test/Models/FrontMatterTests.cs +++ b/test/Models/FrontMatterTests.cs @@ -67,7 +67,7 @@ public class FrontMatterTests : TestSetup [InlineData("2023-07-11", "2023-07-12", "2023-07-12")] [InlineData("2023-07-11", null, "2023-07-11")] [InlineData(null, null, null)] - public void GetPublishDate_Returns_PublishDate_If_Not_Null_Otherwise_Date(string dateString, string publishDateString, string expectedDateString) + public void GetPublishDate_Returns_PublishDate_If_Not_Null_Otherwise_Date(string? dateString, string? publishDateString, string? expectedDateString) { // Arrange var date = string.IsNullOrEmpty(dateString) ? (DateTime?)null : DateTime.Parse(dateString, CultureInfo.InvariantCulture); diff --git a/test/Models/PageTests.cs b/test/Models/PageTests.cs index 25ba01f..29d87f0 100644 --- a/test/Models/PageTests.cs +++ b/test/Models/PageTests.cs @@ -223,7 +223,7 @@ word03 word04 word05 6 7 eight [Theory] [InlineData(null, "/test-title")] [InlineData("{{ page.Title }}/{{ page.SourceFileNameWithoutExtension }}", "/test-title/file")] - public void Permalink_CreateWithDefaultOrCustomURLTemplate(string urlTemplate, string expectedPermalink) + public void Permalink_CreateWithDefaultOrCustomURLTemplate(string? urlTemplate, string expectedPermalink) { var page = new Page(new FrontMatter { @@ -270,10 +270,13 @@ word03 word04 word05 6 7 eight [InlineData(markdown2CONST, markdownPlain2CONST)] public void Plain_ShouldReturnCorrectPlainString(string rawContent, string plain) { + ArgumentException.ThrowIfNullOrEmpty(plain); var page = new Page(new FrontMatter { RawContent = rawContent }, site); + // Required to make the test pass on Windows + plain = plain.Replace("\r\n", "\n", StringComparison.Ordinal); // Assert Assert.Equal(plain, page.Plain); diff --git a/test/ServerHandlers/PingRequestHandlerTests.cs b/test/ServerHandlers/PingRequestHandlerTests.cs index 0d7ad20..1626c4a 100644 --- a/test/ServerHandlers/PingRequestHandlerTests.cs +++ b/test/ServerHandlers/PingRequestHandlerTests.cs @@ -32,7 +32,6 @@ public class PingRequestHandlerTests : TestSetup [Theory] [InlineData("/ping", true)] [InlineData("ping", false)] - [InlineData(null, false)] public void Check_HandlesVariousRequestPaths(string requestPath, bool expectedResult) { // Arrange -- GitLab