Rev | Line | |
---|
[254] | 1 | '--------------------------------------------------------------------
|
---|
| 2 | ' Test case of Path Class
|
---|
| 3 | '--------------------------------------------------------------------
|
---|
| 4 |
|
---|
| 5 | Namespace PathTest
|
---|
| 6 |
|
---|
[271] | 7 | Imports System.IO
|
---|
| 8 |
|
---|
[254] | 9 | Sub TestMain()
|
---|
| 10 | Dim testPath = New String("C:\Dir.Name\file.name.ext")
|
---|
| 11 | UnitTest("Path.GetFileName", Path.GetFileName(testPath) = "file.name.ext")
|
---|
| 12 |
|
---|
| 13 | UnitTest("Path.GetFileNameWithoutExtension", Path.GetFileNameWithoutExtension(testPath) = "file.name")
|
---|
| 14 |
|
---|
| 15 |
|
---|
| 16 | UnitTest("Path.GetExtension", Path.GetExtension(testPath) = ".ext")
|
---|
| 17 |
|
---|
| 18 | UnitTest("Path.ChangeExtension", Path.ChangeExtension(testPath, ".newExt") = "C:\Dir.Name\file.name.newExt")
|
---|
| 19 |
|
---|
| 20 | UnitTest("Path.HasExtension (Case1)", Path.HasExtension(testPath) = True)
|
---|
| 21 | UnitTest("Path.HasExtension (Case2)", Path.HasExtension("fileName") = False)
|
---|
| 22 |
|
---|
| 23 | UnitTest("Path.GetPathRoot", Path.GetPathRoot(testPath) = "C:\")
|
---|
| 24 |
|
---|
| 25 | UnitTest("Path.IsPathRooted (Case1)", Path.IsPathRooted(testPath) = True)
|
---|
| 26 | UnitTest("Path.IsPathRooted (Case2)", Path.IsPathRooted("Dir.Name\file.name.ext") = False)
|
---|
| 27 |
|
---|
| 28 | UnitTest("Path.Combine (Case1)", Path.Combine("C:\dir", "filename.txt") = "C:\dir\filename.txt")
|
---|
| 29 | UnitTest("Path.Combine (Case2)", Path.Combine("C:\dir\", "filename.txt") = "C:\dir\filename.txt")
|
---|
| 30 |
|
---|
| 31 | /*
|
---|
| 32 | テストしていないメソッド
|
---|
| 33 | GetRandomFileName
|
---|
| 34 | GetTempFileName
|
---|
| 35 | GetTempPath
|
---|
| 36 | GetFullPath
|
---|
| 37 | */
|
---|
| 38 | End Sub
|
---|
| 39 |
|
---|
| 40 | End Namespace
|
---|
[411] | 41 |
|
---|
[254] | 42 | PathTest.TestMain()
|
---|
Note:
See
TracBrowser
for help on using the repository browser.