Initial commit
This commit is contained in:
47
VirtualFS.Tests/PathTests.cs
Normal file
47
VirtualFS.Tests/PathTests.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
namespace VirtualFS.Tests
|
||||
{
|
||||
[TestClass]
|
||||
public class PathTests
|
||||
{
|
||||
[TestMethod]
|
||||
public virtual void TestPathCast()
|
||||
{
|
||||
Path p = "/test/path";
|
||||
|
||||
Assert.IsNotNull(p);
|
||||
Assert.AreEqual("/test/path", (string)p);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public virtual void TestPathDirectoryNotDirectory()
|
||||
{
|
||||
Assert.IsFalse(((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");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public virtual void TestPathExt()
|
||||
{
|
||||
Assert.AreEqual("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"));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user