mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-04 19:27:21 +00:00
Upgraded to .NET 10 (#1147)
This commit is contained in:
1 parent
faae2951f7
commit
fc7399e81b
327 files changed
+3059
-3049
No files matched your search
@@ -11,14 +11,14 @@ public sealed class FileExportFormatTests
|
||||
[Test]
|
||||
public void OnlyTheTwoOfficeFormatsRefuseAPageInALocalLink()
|
||||
{
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(FileExportFormat.MICROSOFT_WORD.FollowsPageAnchors(), Is.False, "Word looks for a file whose name ends in the fragment, finds none, and refuses the link.");
|
||||
Assert.That(FileExportFormat.OPEN_DOCUMENT_TEXT.FollowsPageAnchors(), Is.False, "LibreOffice does the same, verified on 2026-09-15 with an exported .odt.");
|
||||
Assert.That(FileExportFormat.HTML.FollowsPageAnchors(), Is.True, "A browser opens the document on the page the fragment names.");
|
||||
Assert.That(FileExportFormat.MARKDOWN.FollowsPageAnchors(), Is.True);
|
||||
Assert.That(FileExportFormat.LATEX.FollowsPageAnchors(), Is.True);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -57,13 +57,13 @@ public sealed class FileExportFormatTests
|
||||
[Test]
|
||||
public void OnlyAWebPageNeedsAPageTitle()
|
||||
{
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(FileExportFormat.HTML.NeedsPageTitle(), Is.True, "Without one, the browser tab shows the random name of the temporary file Pandoc read.");
|
||||
Assert.That(FileExportFormat.MICROSOFT_WORD.NeedsPageTitle(), Is.False, "Word would keep it as a document property nobody asked for.");
|
||||
Assert.That(FileExportFormat.OPEN_DOCUMENT_TEXT.NeedsPageTitle(), Is.False, "The same goes for an OpenDocument file.");
|
||||
Assert.That(FileExportFormat.LATEX.NeedsPageTitle(), Is.False);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[TestCase("html", FileExportFormat.HTML)]
|
||||
@@ -79,18 +79,18 @@ public sealed class FileExportFormatTests
|
||||
[TestCase(" md ", FileExportFormat.MARKDOWN, Description = "Space around the name is no part of it.")]
|
||||
public void AFenceLanguageNamesItsFormat(string language, FileExportFormat expectedFormat)
|
||||
{
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(FileExportFormatExtensions.TryFromCodeFenceLanguage(language, out var format), Is.True);
|
||||
Assert.That(format, Is.EqualTo(expectedFormat));
|
||||
Assert.That(format.IsPlainText(), Is.True, "A code block holds text, so the export writes it as it is.");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void OnlyTheTwoOfficeFormatsAreNoPlainText()
|
||||
{
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(FileExportFormat.MICROSOFT_WORD.IsPlainText(), Is.False, "A Word file is an archive, and writing text into one breaks it.");
|
||||
Assert.That(FileExportFormat.OPEN_DOCUMENT_TEXT.IsPlainText(), Is.False);
|
||||
@@ -102,18 +102,18 @@ public sealed class FileExportFormatTests
|
||||
Assert.That(FileExportFormat.CSV.IsPlainText(), Is.True);
|
||||
Assert.That(FileExportFormat.TSV.IsPlainText(), Is.True);
|
||||
Assert.That(FileExportFormat.SOURCE_CODE.IsPlainText(), Is.True, "Code is text, whatever its language.");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CodeLeavesItsFileToItsLanguage()
|
||||
{
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(FileExportFormat.SOURCE_CODE.ToFileExtension(), Is.Empty, "Python and Rust share the format, but not the extension.");
|
||||
Assert.That(FileExportFormat.SOURCE_CODE.ToFileTypeFilter(), Is.Null, "Without the language, the save dialog would offer the wrong files.");
|
||||
Assert.That(FileExportFormatExtensions.ANSWER_FORMATS, Does.Not.Contain(FileExportFormat.SOURCE_CODE), "Code is one block out of an answer, never the answer itself.");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[TestCase("css", TestName = "A language without a format of its own")]
|
||||
@@ -122,11 +122,11 @@ public sealed class FileExportFormatTests
|
||||
[TestCase(null, TestName = "A fence Markdig read no language for")]
|
||||
public void AnyOtherFenceLanguageNamesNoFormat(string? language)
|
||||
{
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(FileExportFormatExtensions.TryFromCodeFenceLanguage(language, out var format), Is.False);
|
||||
Assert.That(format, Is.EqualTo(FileExportFormat.NONE));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[TestCase(FileExportFormat.HTML)]
|
||||
@@ -135,14 +135,14 @@ public sealed class FileExportFormatTests
|
||||
{
|
||||
var found = format.TryToComment("A page titled --> Start, and one titled --!> Next", out var comment);
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(found, Is.True);
|
||||
Assert.That(comment, Does.StartWith("<!--"));
|
||||
Assert.That(comment.IndexOf("-->", StringComparison.Ordinal), Is.EqualTo(comment.Length - 3), "Only the end of the comment may end it; the title would spill onto the page otherwise.");
|
||||
Assert.That(comment, Does.Not.Contain("--!>"), "A browser ends a comment there as well.");
|
||||
Assert.That(comment, Does.Contain("Start").And.Contain("Next"), "The title stays readable.");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -158,11 +158,11 @@ public sealed class FileExportFormatTests
|
||||
{
|
||||
var found = FileExportFormat.LATEX.TryToComment(Lines("# Sources", string.Empty, "- [1] A title with 100 % and a_b"), out var comment);
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(found, Is.True);
|
||||
Assert.That(comment.Split(Environment.NewLine), Is.EqualTo(new[] { "% # Sources", "%", "% - [1] A title with 100 % and a_b" }), "LaTeX has no end of a comment, only the end of a line.");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[TestCase(FileExportFormat.CSV)]
|
||||
@@ -170,11 +170,11 @@ public sealed class FileExportFormatTests
|
||||
[TestCase(FileExportFormat.MICROSOFT_WORD)]
|
||||
public void AFormatWithoutCommentsSaysSo(FileExportFormat format)
|
||||
{
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(format.TryToComment("A text.", out var comment), Is.False);
|
||||
Assert.That(comment, Is.Empty);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private static string Lines(params string[] lines) => string.Join(Environment.NewLine, lines);
|
||||
|
||||
Reference in new issue
Block a user