Fix unit tests

This commit is contained in:
Robert McRackan 2025-02-23 10:28:09 -05:00
parent 3167744111
commit 6a40d19393

View File

@ -26,13 +26,13 @@ namespace FileUtilityTests
// standardize slashes. There is no unix equivalent because there is no alt directory separator // standardize slashes. There is no unix equivalent because there is no alt directory separator
[DataRow(@"a/b\c/d", @"a\b\c\d", PlatformID.Win32NT)] [DataRow(@"a/b\c/d", @"a\b\c\d", PlatformID.Win32NT)]
// remove illegal chars // remove illegal chars
[DataRow("a*?:z.txt", "a✱z.txt", PlatformID.Win32NT)] [DataRow("a*?:z.txt", "a✱_z.txt", PlatformID.Win32NT)]
[DataRow("a*?:z.txt", "a*?:z.txt", PlatformID.Unix)] [DataRow("a*?:z.txt", "a*?:z.txt", PlatformID.Unix)]
// retain drive letter path colon // retain drive letter path colon
[DataRow(@"C:\az.txt", @"C:\az.txt", PlatformID.Win32NT)] [DataRow(@"C:\az.txt", @"C:\az.txt", PlatformID.Win32NT)]
[DataRow(@"/:/az.txt", @"/:/az.txt", PlatformID.Unix)] [DataRow(@"/:/az.txt", @"/:/az.txt", PlatformID.Unix)]
// replace all other colons // replace all other colons
[DataRow(@"a\b:c\d.txt", @"a\bc\d.txt", PlatformID.Win32NT)] [DataRow(@"a\b:c\d.txt", @"a\b_c\d.txt", PlatformID.Win32NT)]
[DataRow(@"a/b:c/d.txt", @"a/b:c/d.txt", PlatformID.Unix)] [DataRow(@"a/b:c/d.txt", @"a/b:c/d.txt", PlatformID.Unix)]
// remove empty directories // remove empty directories
[DataRow(@"C:\a\\\b\c\\\d.txt", @"C:\a\b\c\d.txt", PlatformID.Win32NT)] [DataRow(@"C:\a\\\b\c\\\d.txt", @"C:\a\b\c\d.txt", PlatformID.Win32NT)]
@ -104,13 +104,13 @@ namespace FileUtilityTests
// needs separate method. middle null param not running correctly in TestExplorer when used in DataRow() // needs separate method. middle null param not running correctly in TestExplorer when used in DataRow()
[TestMethod] [TestMethod]
[DataRow("http://test.com/a/b/c", "httptest.comabc", PlatformID.Win32NT)] [DataRow("http://test.com/a/b/c", "http_test.comabc", PlatformID.Win32NT)]
[DataRow("http://test.com/a/b/c", "http:test.comabc", PlatformID.Unix)] [DataRow("http://test.com/a/b/c", "http:test.comabc", PlatformID.Unix)]
public void url_null_replacement(string inStr, string outStr, PlatformID platformID) => DefaultReplacementTest(inStr, outStr, platformID); public void url_null_replacement(string inStr, string outStr, PlatformID platformID) => DefaultReplacementTest(inStr, outStr, platformID);
[TestMethod] [TestMethod]
// empty replacement // empty replacement
[DataRow("http://test.com/a/b/c", "httptest.comabc", PlatformID.Win32NT)] [DataRow("http://test.com/a/b/c", "http_test.comabc", PlatformID.Win32NT)]
[DataRow("http://test.com/a/b/c", "http:test.comabc", PlatformID.Unix)] [DataRow("http://test.com/a/b/c", "http:test.comabc", PlatformID.Unix)]
public void DefaultReplacementTest(string inStr, string outStr, PlatformID platformID) => Test(inStr, outStr, Default, platformID); public void DefaultReplacementTest(string inStr, string outStr, PlatformID platformID) => Test(inStr, outStr, Default, platformID);