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

@@ -25,12 +25,12 @@ public sealed class ChatComposerStateTests
composer.RestoreFromDraft(draft);
Assert.Multiple(() =>
using (Assert.EnterMultipleScope())
{
Assert.That(composer.UserInput, Is.EqualTo("Summarize the meeting"));
Assert.That(composer.FileAttachments.Select(attachment => attachment.FilePath), Is.EqualTo(new[] { "/documents/agenda.pdf" }));
Assert.That(composer.HasUserDraft, Is.True, "A chat template must not replace the message the user came back to.");
});
}
}
[Test]
@@ -41,11 +41,11 @@ public sealed class ChatComposerStateTests
composer.RestoreFromDraft(new ChatDraft());
Assert.Multiple(() =>
using (Assert.EnterMultipleScope())
{
Assert.That(composer.UserInput, Is.Empty, "The message of the chat before belongs to that chat.");
Assert.That(composer.HasUserDraft, Is.False, "Nobody started a message in this chat, so a chat template may still fill the composer.");
});
}
}
[Test]
@@ -55,10 +55,10 @@ public sealed class ChatComposerStateTests
composer.ApplyTemplate(new ChatTemplate { PredefinedUserPrompt = "Translate the following text:" });
Assert.Multiple(() =>
using (Assert.EnterMultipleScope())
{
Assert.That(composer.UserInput, Is.EqualTo("Translate the following text:"));
Assert.That(composer.HasUserDraft, Is.False, "Leaving the chat must not warn about a message the user never wrote.");
});
}
}
}
@@ -132,11 +132,11 @@ public sealed class ConfigurationFileExclusionsTests
component.LockField = locked;
await component.ReplaceAsync("bin/;*.tmp");
Assert.Multiple(() =>
using (Assert.EnterMultipleScope())
{
Assert.That(component.Draft, Is.EqualTo("*.original"));
Assert.That(component.StoredText, Is.EqualTo("*.original"));
});
}
}
finally
{
@@ -155,11 +155,11 @@ public sealed class ConfigurationFileExclusionsTests
component.Edit("old/;:text:");
await component.ReplaceAsync("bin/;:text:");
Assert.Multiple(() =>
using (Assert.EnterMultipleScope())
{
Assert.That(component.Draft, Is.EqualTo("bin/;:text:"));
Assert.That(component.StoredText, Is.EqualTo("*.original"));
});
}
}
finally
{
+10 -10
View File
@@ -24,11 +24,11 @@ public sealed class ContentViewerTests
var shown = ContentViewer.CutAtLineBreak(TEXT, 100, out var cutOffCharacters);
Assert.Multiple(() =>
using (Assert.EnterMultipleScope())
{
Assert.That(shown, Is.SameAs(TEXT));
Assert.That(cutOffCharacters, Is.Zero);
});
}
}
[Test]
@@ -38,11 +38,11 @@ public sealed class ContentViewerTests
var shown = ContentViewer.CutAtLineBreak(text, 50, out var cutOffCharacters);
Assert.Multiple(() =>
using (Assert.EnterMultipleScope())
{
Assert.That(shown, Is.EqualTo(text));
Assert.That(cutOffCharacters, Is.Zero);
});
}
}
[Test]
@@ -52,11 +52,11 @@ public sealed class ContentViewerTests
var shown = ContentViewer.CutAtLineBreak(TEXT, 25, out var cutOffCharacters);
Assert.Multiple(() =>
using (Assert.EnterMultipleScope())
{
Assert.That(shown, Is.EqualTo("| a | b |\n| 1 | 2 |\n"), "The last table row would be torn apart, so it goes as a whole.");
Assert.That(cutOffCharacters, Is.EqualTo(TEXT.Length - shown.Length));
});
}
}
[Test]
@@ -69,11 +69,11 @@ public sealed class ContentViewerTests
const string TEXT = "The budget $\\rho$ is spent on the hardest tokens.";
static bool HasMath(Markdig.MarkdownPipeline pipeline) => Markdig.Markdown.Parse(TEXT, pipeline).Descendants<MathInline>().Any();
Assert.Multiple(() =>
using (Assert.EnterMultipleScope())
{
Assert.That(HasMath(Markdown.SAFE_MARKDOWN_PIPELINE), Is.True, "The safe pipeline reads this as math.");
Assert.That(HasMath(Markdown.CONTENT_MARKDOWN_PIPELINE), Is.False, "What AI Studio read from a document stays text.");
});
}
}
[Test]
@@ -83,10 +83,10 @@ public sealed class ContentViewerTests
var shown = ContentViewer.CutAtLineBreak(text, 20, out var cutOffCharacters);
Assert.Multiple(() =>
using (Assert.EnterMultipleScope())
{
Assert.That(shown, Has.Length.EqualTo(20));
Assert.That(cutOffCharacters, Is.EqualTo(10));
});
}
}
}
@@ -24,12 +24,12 @@ public sealed class FileExclusionEditorStateTests
{
var state = Create(text);
Assert.Multiple(() =>
using (Assert.EnterMultipleScope())
{
Assert.That(state.FolderText, Is.EqualTo("node_modules/; bin/"));
Assert.That(state.FileText, Is.EqualTo("*.min.js; draft-*"));
Assert.That(state.Text, Is.EqualTo(text));
});
}
}
[Test]
@@ -38,12 +38,12 @@ public sealed class FileExclusionEditorStateTests
var state = Create("bin/;*.min.js;draft-*");
state.EditFolders("obj/\nbuild/");
Assert.Multiple(() =>
using (Assert.EnterMultipleScope())
{
Assert.That(FileExclusions.Parse(state.Text), Is.EqualTo(new[] { "obj/", "build/", "*.min.js", "draft-*" }));
Assert.That(state.FileText, Is.EqualTo("*.min.js; draft-*"));
Assert.That(state.Text, Is.EqualTo("obj/; build/; *.min.js; draft-*"));
});
}
}
[Test]
@@ -52,12 +52,12 @@ public sealed class FileExclusionEditorStateTests
var state = Create("bin/;node_modules/;*.min.js");
state.EditFiles("*.wav;*.md");
Assert.Multiple(() =>
using (Assert.EnterMultipleScope())
{
Assert.That(FileExclusions.Parse(state.Text), Is.EqualTo(new[] { "bin/", "node_modules/", "*.wav", "*.md" }));
Assert.That(state.FolderText, Is.EqualTo("bin/; node_modules/"));
Assert.That(state.Text, Is.EqualTo("bin/; node_modules/; *.wav; *.md"));
});
}
}
[TestCase("")]
@@ -80,7 +80,7 @@ public sealed class FileExclusionEditorStateTests
state.EditFolders("node_modules/;cmake-build-*/");
var patterns = FileExclusions.Parse(state.Text);
Assert.Multiple(() =>
using (Assert.EnterMultipleScope())
{
Assert.That(patterns, Is.EqualTo(new[] { "node_modules/", "cmake-build-*/" }));
Assert.That(FileExclusions.IsValid(state.Text), Is.True);
@@ -88,7 +88,7 @@ public sealed class FileExclusionEditorStateTests
Assert.That(FileExclusions.ExcludesFolder("node_modules", patterns), Is.True);
Assert.That(FileExclusions.ExcludesFolder("cmake-build-debug", patterns), Is.True);
Assert.That(FileExclusions.ExcludesFile("node_modules", patterns), Is.False);
});
}
}
[TestCase(":text:")]
@@ -103,11 +103,11 @@ public sealed class FileExclusionEditorStateTests
else
state.EditFolders("bin/");
Assert.Multiple(() =>
using (Assert.EnterMultipleScope())
{
Assert.That(FileExclusions.Parse(state.Text), Does.Contain(invalidRule));
Assert.That(FileExclusions.IsValid(state.Text), Is.False);
});
}
}
[TestCase(":text:")]
@@ -117,11 +117,11 @@ public sealed class FileExclusionEditorStateTests
var state = Create(string.Empty);
state.EditFolders(selector);
Assert.Multiple(() =>
using (Assert.EnterMultipleScope())
{
Assert.That(state.Text, Is.EqualTo(selector));
Assert.That(FileExclusions.IsValid(state.Text), Is.False);
});
}
}
[Test]
@@ -156,12 +156,12 @@ public sealed class FileExclusionEditorStateTests
else
state.RestoreFiles(DEFAULTS);
Assert.Multiple(() =>
using (Assert.EnterMultipleScope())
{
Assert.That(state.FolderText, Is.EqualTo(folders ? "bin/; node_modules/" : "latest/; "));
Assert.That(state.FileText, Is.EqualTo(folders ? "*.latest; " : "*.tmp; *.bak"));
Assert.That(state.Text, Is.EqualTo(folders ? "bin/; node_modules/; *.latest" : "latest/; *.tmp; *.bak"));
});
}
}
[TestCase(true)]
@@ -187,11 +187,11 @@ public sealed class FileExclusionEditorStateTests
else
state.RestoreFiles(FileExclusions.DEFAULT_PATTERNS);
Assert.Multiple(() =>
using (Assert.EnterMultipleScope())
{
Assert.That(FileExclusions.Parse(state.Text), Does.Contain(invalidRule));
Assert.That(FileExclusions.IsValid(state.Text), Is.False);
});
}
}
[Test]
@@ -199,13 +199,13 @@ public sealed class FileExclusionEditorStateTests
{
var state = Create("bin/;*.min.js");
state.EditFiles("obj/;*.wav;draft-*");
Assert.Multiple(() =>
using (Assert.EnterMultipleScope())
{
Assert.That(state.IsValid, Is.False);
Assert.That(state.Text, Is.EqualTo("bin/; obj/; *.wav; draft-*"));
Assert.That(state.FolderText, Is.EqualTo("bin/"));
Assert.That(state.FileText, Is.EqualTo("obj/;*.wav;draft-*"));
});
}
}
[TestCase(true)]
@@ -230,12 +230,12 @@ public sealed class FileExclusionEditorStateTests
state.Receive(earlierValue);
state.Receive(state.Text);
Assert.Multiple(() =>
using (Assert.EnterMultipleScope())
{
Assert.That(state.FolderText, Is.EqualTo("obj/; build/; "));
Assert.That(state.FileText, Is.EqualTo("*.wav; draft-*; "));
Assert.That(state.Text, Is.EqualTo("obj/; build/; *.wav; draft-*"));
});
}
}
[Test]
@@ -247,11 +247,11 @@ public sealed class FileExclusionEditorStateTests
state.EditFiles("*.latest");
state.Receive(earlierValue);
Assert.Multiple(() =>
using (Assert.EnterMultipleScope())
{
Assert.That(state.Text, Is.EqualTo("*.latest"));
Assert.That(state.FileText, Is.EqualTo("*.latest"));
});
}
}
[Test]
@@ -271,11 +271,11 @@ public sealed class FileExclusionEditorStateTests
state.EditFiles("*.latest");
state.Receive("policy/;*.secret");
Assert.Multiple(() =>
using (Assert.EnterMultipleScope())
{
Assert.That(state.FolderText, Is.EqualTo("policy/"));
Assert.That(state.FileText, Is.EqualTo("*.secret"));
});
}
}
[Test]
@@ -311,7 +311,7 @@ public sealed class FileExclusionEditorStateTests
state.EditFolders(":text:");
state.Reset(FileExclusions.DEFAULT_PATTERNS);
Assert.Multiple(() =>
using (Assert.EnterMultipleScope())
{
Assert.That(state.Text, Is.EqualTo(FileExclusions.DEFAULT_PATTERNS));
Assert.That(FileExclusions.IsValid(state.Text), Is.True);
@@ -319,7 +319,7 @@ public sealed class FileExclusionEditorStateTests
Assert.That(state.FileText, Does.Contain("*.exe"));
Assert.That(state.FolderText, Does.Not.Contain("\n").And.Not.Contain("\r"));
Assert.That(state.FileText, Does.Not.Contain("\n").And.Not.Contain("\r"));
});
}
}
[Test]
@@ -341,14 +341,14 @@ public sealed class FileExclusionEditorStateTests
var state = Create("bin/;*.tmp");
state.EditFolders(pattern);
Assert.Multiple(() =>
using (Assert.EnterMultipleScope())
{
Assert.That(state.IsValid, Is.False);
Assert.That(state.FolderText, Is.EqualTo(pattern));
Assert.That(FileExclusions.Parse(state.Text), Does.Contain(pattern));
Assert.That(FileExclusions.Parse(state.Text), Does.Not.Contain(pattern + "/"));
Assert.That(state.FileText, Is.EqualTo("*.tmp"));
});
}
}
[Test]
@@ -360,12 +360,12 @@ public sealed class FileExclusionEditorStateTests
state.EditFiles("*.bak;obj/");
state.Receive(earlierValue);
Assert.Multiple(() =>
using (Assert.EnterMultipleScope())
{
Assert.That(state.IsValid, Is.False);
Assert.That(state.FileText, Is.EqualTo("*.bak;obj/"));
Assert.That(state.FolderText, Is.EqualTo("bin/"));
});
}
}
private static FileExclusionEditorState Create(string text)
@@ -68,11 +68,11 @@ public sealed class FileExclusionEditorTests
await editor.EditAsync(folders ? "*.keep;wrong/" : "*.wrong", folders: !folders);
await editor.ResetAsync(folders);
Assert.Multiple(() =>
using (Assert.EnterMultipleScope())
{
Assert.That(published, Is.Empty);
Assert.That(resets, Is.Empty);
});
}
await editor.EditAsync(folders ? "*.keep" : "keep/", folders: !folders);
Assert.That(published, Is.EqualTo(new[] { folders ? "bin/; *.keep" : "keep/; *.tmp" }));
@@ -90,11 +90,11 @@ public sealed class FileExclusionEditorTests
await editor.EditAsync(folders ? "*.wrong" : "wrong/", folders);
await editor.ResetAsync(folders);
Assert.Multiple(() =>
using (Assert.EnterMultipleScope())
{
Assert.That(published, Is.Empty);
Assert.That(resets, Is.EqualTo(new[] { folders ? "bin/; *.custom" : "custom/; *.tmp" }));
});
}
}
[Test]
@@ -114,11 +114,11 @@ public sealed class FileExclusionEditorTests
await editor.ResetAsync(folders: true);
await editor.ResetAsync(folders: false);
Assert.Multiple(() =>
using (Assert.EnterMultipleScope())
{
Assert.That(published, Is.Empty);
Assert.That(resets, Is.Empty);
});
}
editor.SetParameters(new() { [nameof(FileExclusionEditor.ResetRequested)] = default(EventCallback<string>) });
await editor.ResetAsync(folders: true);
@@ -140,11 +140,11 @@ public sealed class FileExclusionEditorTests
await editor.EditAsync("*.wrong", folders: true);
Assert.Multiple(() =>
using (Assert.EnterMultipleScope())
{
Assert.That(editor.IsValid, Is.False);
Assert.That(published, Is.Empty);
});
}
await editor.EditAsync("custom/", folders: true);
Assert.That(editor.IsValid, Is.True);
@@ -27,13 +27,13 @@ public sealed class MailFolderPickerTests
Folder("Archive", specialUse: MailFolderSpecialUse.ARCHIVE),
Folder("INBOX", isInbox: true));
Assert.Multiple(() =>
using (Assert.EnterMultipleScope())
{
Assert.That(root.Value, Is.Empty, "The root does not stand for the whole mailbox.");
Assert.That(root.Text, Is.EqualTo(WHOLE_MAILBOX));
Assert.That(ValuesOf(root), Is.EqualTo(new[] { "INBOX", "Archive", "Projects" }), "The top level is not ordered with the inbox first.");
Assert.That(ValuesOf(Child(root, "Projects")), Is.EqualTo(new[] { "Projects/Alpha" }), "The subfolder did not land below its parent.");
});
}
}
[Test]
@@ -44,11 +44,11 @@ public sealed class MailFolderPickerTests
Folder("INBOX.Sent", "INBOX", separator: '.', specialUse: MailFolderSpecialUse.SENT),
Folder("INBOX.Drafts", "INBOX", separator: '.', specialUse: MailFolderSpecialUse.DRAFTS));
Assert.Multiple(() =>
using (Assert.EnterMultipleScope())
{
Assert.That(ValuesOf(root), Is.EqualTo(new[] { "INBOX" }));
Assert.That(ValuesOf(Child(root, "INBOX")), Is.EqualTo(new[] { "INBOX.Drafts", "INBOX.Sent" }));
});
}
}
[Test]
@@ -85,13 +85,13 @@ public sealed class MailFolderPickerTests
};
var root = MailFolderPicker.BuildTree(folders, "Projects/Alpha/Reports", WHOLE_MAILBOX).Single();
Assert.Multiple(() =>
using (Assert.EnterMultipleScope())
{
Assert.That(root.Expanded, Is.True, "The whole mailbox is collapsed.");
Assert.That(Child(root, "Projects").Expanded, Is.True, "The way to the picked folder is collapsed.");
Assert.That(Child(Child(root, "Projects"), "Projects/Alpha").Expanded, Is.True, "The way to the picked folder is collapsed.");
Assert.That(Child(root, "Private").Expanded, Is.False, "A folder off the way to the picked folder is expanded.");
});
}
}
[TestCase(MailFolderSpecialUse.NONE, ExpectedResult = true)]