|
1 | | -using nanoFramework.TestFramework; |
| 1 | +// |
| 2 | +// Copyright (c) .NET Foundation and Contributors |
| 3 | +// See LICENSE file in the project root for full license information. |
| 4 | + |
| 5 | +using nanoFramework.TestFramework; |
2 | 6 |
|
3 | 7 | namespace System.IO.FileSystem.UnitTests |
4 | 8 | { |
@@ -103,7 +107,7 @@ public void Combine_throws_if_path2_is_null() |
103 | 107 | [TestMethod] |
104 | 108 | public void GetDirectoryName_returns_directory() |
105 | 109 | { |
106 | | - var tests = new[] { @"I:\directory", @"I:\directory\", @"I:\directory\file.ext" }; |
| 110 | + var tests = new[] { @"I:\directory", @"I:\directory\", @"I:\directory\file.ext" }; |
107 | 111 | var answers = new[] { @"I:\", @"I:\directory", @"I:\directory" }; |
108 | 112 |
|
109 | 113 | for (var i = 0; i < tests.Length; i++) |
@@ -311,26 +315,27 @@ public void GetPathRoot_returns_root_UNC_paths() |
311 | 315 | } |
312 | 316 | } |
313 | 317 |
|
| 318 | + [DataRow(@"\dir1\dir2\file.ext")] |
| 319 | + [DataRow(@"\dir1\dir2\file.ext")] |
| 320 | + [DataRow(@"\dir1\..\dir2\file.ext")] |
| 321 | + [DataRow(@"\dir1\..\dir2\..\dir3\file.ext")] |
314 | 322 | [TestMethod] |
315 | | - public void GetFullPath0() |
316 | | - { |
317 | | - string fullPath = Path.GetFullPath(@"dir1\dir2\file.ext"); |
318 | | - |
319 | | - Assert.AreEqual(@"\dir1\dir2\file.ext", fullPath); |
320 | | - } |
321 | | - |
322 | | - [TestMethod] |
323 | | - public void GetFullPath1() |
| 323 | + public void GetFullPathWithFiles(string pathToTest) |
324 | 324 | { |
325 | | - string fullPath = Path.GetFullPath(@"\dir1\dir2\file.ext"); |
326 | | - Assert.AreEqual(@"\dir1\dir2\file.ext", fullPath); |
327 | | - } |
| 325 | + string fullPath = Path.GetFullPath(pathToTest); |
| 326 | + Assert.AreEqual(pathToTest, fullPath); |
| 327 | + } |
328 | 328 |
|
| 329 | + [DataRow(@"\dir1\..\..\dir2\", @"\dir1\..\..\dir2\")] |
| 330 | + [DataRow(@"\dir1\..\..\dir2", @"\dir1\..\..\dir2")] |
| 331 | + [DataRow(@"dir1\dir2\", @"dir1\dir2\")] |
| 332 | + [DataRow(@"dir1\dir2", @"dir1\dir2")] |
| 333 | + [DataRow(@"\dir1\dir2\", @"\dir1\dir2\")] |
329 | 334 | [TestMethod] |
330 | | - public void GetFullPath2() |
| 335 | + public void GetFullPathWithDirectories(string pathToTest, string expectedPath) |
331 | 336 | { |
332 | | - string fullPath = Path.GetFullPath(@"\dir1\..\dir2\file.ext"); |
333 | | - Assert.AreEqual(@"\dir1\..\dir2\file.ext", fullPath); |
| 337 | + string fullPath = Path.GetFullPath(pathToTest); |
| 338 | + Assert.AreEqual(expectedPath, fullPath); |
334 | 339 | } |
335 | 340 |
|
336 | 341 | [TestMethod] |
@@ -398,7 +403,7 @@ public void IsPathRooted_returns_true() |
398 | 403 | { |
399 | 404 | var tests = new[] |
400 | 405 | { |
401 | | - @"\", "/", "I:", @"I:\", @"I:\file.ext", @"I:\directory\file.ext" |
| 406 | + @"\", "/", "I:", @"I:\", @"I:\file.ext", @"I:\directory\file.ext" |
402 | 407 | }; |
403 | 408 |
|
404 | 409 | for (var i = 0; i < tests.Length; i++) |
|
0 commit comments