Upgraded to .NET 10 (#1147)

This commit is contained in:
Thorsten Sommer authored and GitHub committed 2026-11-01 20:32:16 +01:00
1 parent faae2951f7
commit fc7399e81b
327 files changed
+3059 -3049

No files matched your search

@@ -135,7 +135,7 @@ public sealed class AppAccessMiddlewareTests
var response = await BootAsync(HttpMethods.Get, UI_TOKEN);
var cookie = response.Headers.SetCookie.ToString().ToLowerInvariant();
Assert.Multiple(() =>
using (Assert.EnterMultipleScope())
{
Assert.That(response.StatusCode, Is.EqualTo(StatusCodes.Status302Found));
Assert.That(response.Headers.Location.ToString(), Is.EqualTo("/"));
@@ -144,7 +144,7 @@ public sealed class AppAccessMiddlewareTests
Assert.That(cookie, Does.Contain("samesite=lax"));
Assert.That(cookie, Does.Contain("path=/"));
Assert.That(cookie, Does.Not.Contain("expires"));
});
}
}
[TestCase("0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdee")]
@@ -154,11 +154,11 @@ public sealed class AppAccessMiddlewareTests
{
var response = await BootAsync(HttpMethods.Get, token);
Assert.Multiple(() =>
using (Assert.EnterMultipleScope())
{
Assert.That(response.StatusCode, Is.EqualTo(StatusCodes.Status403Forbidden));
Assert.That(response.Headers.SetCookie.ToString(), Is.Empty);
});
}
}
[Test]
@@ -166,11 +166,11 @@ public sealed class AppAccessMiddlewareTests
{
var response = await BootAsync(HttpMethods.Post, UI_TOKEN);
Assert.Multiple(() =>
using (Assert.EnterMultipleScope())
{
Assert.That(response.StatusCode, Is.EqualTo(StatusCodes.Status403Forbidden));
Assert.That(response.Headers.SetCookie.ToString(), Is.Empty);
});
}
}
#endif
}
+34 -4
View File
@@ -1,3 +1,6 @@
using System.Runtime.CompilerServices;
using System.Text.RegularExpressions;
using AIStudio.Assistants.ERI;
using AIStudio.Tools;
@@ -6,12 +9,15 @@ using Changelog = AIStudio.Components.Changelog;
namespace AIStudio.Tests.Tools.AppAccess;
/// <summary>
/// Checks that the app reads the files below wwwroot which it shows itself.
/// Checks that the app reads the files below wwwroot which it shows itself, and that the release
/// can serve every file which the page of the app loads.
/// </summary>
/// <remarks>
/// The changelogs and the ERI specifications come from the files embedded into the app, not from a
/// request to its own server. A file which is missing there would leave the changelog or the ERI
/// assistant empty without any error.
/// assistant empty without any error. The release serves its static files from the same embedded
/// files; one which is missing there leaves the window without styles, or without any interaction
/// at all, while a debug build keeps working.
/// </remarks>
[TestFixture]
public sealed class WebRootFilesTests
@@ -20,6 +26,30 @@ public sealed class WebRootFilesTests
private static IEnumerable<ERIVersion> SpecificationVersions() => Enum.GetValues<ERIVersion>().Where(version => version.WasSpecificationSelected());
private static string ReadAppPageSource([CallerFilePath] string sourceFilePath = "") => File.ReadAllText(Path.Combine(Path.GetDirectoryName(sourceFilePath)!, "..", "..", "..", "MindWork AI Studio", "App.razor"));
/// <summary>
/// Reads the scripts and style sheets which App.razor loads from the app itself, so that a new one
/// is checked without anybody having to add it to a test.
/// </summary>
private static IEnumerable<string> FilesOfTheAppPage() => Regex.Matches(ReadAppPageSource(), @"<(?:script|link)\b[^>]*\b(?:src|href)=""(?<path>[^""]+)""")
.Select(match => match.Groups["path"].Value)
.Where(path => !path.Contains("//", StringComparison.Ordinal));
[Test]
public void TheAppPageLoadsFilesOfTheApp()
{
Assert.That(FilesOfTheAppPage(), Does.Contain("_framework/blazor.web.js").And.Contain("app.css"), "The test no longer finds the scripts and style sheets in App.razor.");
}
[TestCaseSource(nameof(FilesOfTheAppPage))]
public void EveryFileOfTheAppPageIsEmbedded(string path)
{
var file = new WebRootFiles().FileProvider.GetFileInfo(path);
Assert.That(file.Exists, Is.True, $"The release would not serve '{path}', since it is not among the embedded files.");
Assert.That(file.Length, Is.GreaterThan(0), $"The release would serve '{path}' as an empty file.");
}
[TestCaseSource(nameof(ChangelogFiles))]
public async Task EveryChangelogCanBeRead(string filename)
{
@@ -64,10 +94,10 @@ public sealed class WebRootFilesTests
var copied = await new WebRootFiles().CopyToAsync("specs/eri/does-not-exist.json", destinationPath);
Assert.Multiple(() =>
using (Assert.EnterMultipleScope())
{
Assert.That(copied, Is.False);
Assert.That(File.Exists(destinationPath), Is.False);
});
}
}
}