Modernize project targets and Docker test flow

This commit is contained in:
2026-02-28 17:27:20 +01:00
parent 02d95583e9
commit 654bcd8a1b
8 changed files with 161 additions and 122 deletions

View File

@@ -1,47 +1,45 @@
namespace VirtualFS.Tests
namespace VirtualFS.Tests;
public class PathTests
{
[TestClass]
public class PathTests
[Fact]
public void PathCast()
{
[TestMethod]
public virtual void TestPathCast()
{
Path p = "/test/path";
Path path = "/test/path";
Assert.IsNotNull(p);
Assert.AreEqual("/test/path", (string)p);
}
Assert.NotNull(path);
Assert.Equal("/test/path", (string)path);
}
[TestMethod]
public virtual void TestPathDirectoryNotDirectory()
{
Assert.IsFalse(((Path)"/test/path").IsDirectory == ((Path)"/test/path/").IsDirectory);
}
[Fact]
public void FileAndDirectoryPathsDiffer()
{
Assert.False(((Path)"/test/path").IsDirectory == ((Path)"/test/path/").IsDirectory);
}
[TestMethod]
public virtual void TestPathAddPath()
{
Assert.AreEqual((Path)"/test/path/SomeFile.txt", ((Path)"/test/path/") + "SomeFile.txt");
}
[Fact]
public void AppendCombinesDirectoryAndName()
{
Assert.Equal((Path)"/test/path/SomeFile.txt", ((Path)"/test/path/") + "SomeFile.txt");
}
[TestMethod]
public virtual void TestPathExt()
{
Assert.AreEqual("txt", ((Path)"/test/path/SomeFile.txt").GetExtension());
}
[Fact]
public void ExtensionIsReadFromFilePath()
{
Assert.Equal("txt", ((Path)"/test/path/SomeFile.txt").GetExtension());
}
[TestMethod]
public virtual void TestPathParent()
{
Assert.IsNull(new Path().Parent);
Assert.AreEqual(new Path(), ((Path)"/test/").Parent);
Assert.AreEqual((Path)"/test/", ((Path)"/test/path/").Parent);
}
[TestMethod]
public virtual void TestInvalidPath()
{
Assert.ThrowsException<InvalidOperationException>(() => new Path("test"));
}
[Fact]
public void ParentIsResolvedCorrectly()
{
Assert.Null(new Path().Parent);
Assert.Equal(new Path(), ((Path)"/test/").Parent);
Assert.Equal((Path)"/test/", ((Path)"/test/path/").Parent);
}
[Fact]
public void InvalidPathThrows()
{
Assert.Throws<InvalidOperationException>(() => new Path("test"));
}
}