diff --git a/System.IO.FileSystem.UnitTests/FileUnitTests.cs b/System.IO.FileSystem.UnitTests/FileUnitTests.cs index 7992d5a..61cfb3f 100644 --- a/System.IO.FileSystem.UnitTests/FileUnitTests.cs +++ b/System.IO.FileSystem.UnitTests/FileUnitTests.cs @@ -9,10 +9,10 @@ public class FileUnitTests [Setup] public void Setup() { - Assert.SkipTest("These test will only run on real hardware. Comment out this line if you are testing on real hardware."); + //Assert.SkipTest("These test will only run on real hardware. Comment out this line if you are testing on real hardware."); } - private const string Root = @"I:\"; + private const string Root = @"D:\"; private static readonly string Destination = $"{Root}{nameof(FileUnitTests)}-Destination.test"; private static readonly string Source = $"{Root}{nameof(FileUnitTests)}-Source.test"; @@ -225,7 +225,7 @@ public void Delete_deletes_file() [TestMethod] public void Exists_returns_false_if_file_does_not_exist() { - Assert.IsFalse(File.Exists($@"I:\file_does_not_exist-{nameof(FileUnitTests)}.pretty_sure")); + Assert.IsFalse(File.Exists($@"D:\file_does_not_exist-{nameof(FileUnitTests)}.pretty_sure")); } [TestMethod] diff --git a/System.IO.FileSystem.UnitTests/PathUnitTests.cs b/System.IO.FileSystem.UnitTests/PathUnitTests.cs index 903e32d..8d65080 100644 --- a/System.IO.FileSystem.UnitTests/PathUnitTests.cs +++ b/System.IO.FileSystem.UnitTests/PathUnitTests.cs @@ -8,8 +8,8 @@ internal class PathUnitTests [TestMethod] public void ChangeExtension_adds_extension() { - const string path = @"I:\file"; - const string expect = @"I:\file.new"; + const string path = @"D:\file"; + const string expect = @"D:\file.new"; Assert.AreEqual(expect, Path.ChangeExtension(path, "new")); Assert.AreEqual(expect, Path.ChangeExtension(path, ".new")); @@ -18,8 +18,8 @@ public void ChangeExtension_adds_extension() [TestMethod] public void ChangeExtension_changes_extension() { - const string path = @"I:\file.old"; - const string expect = @"I:\file.new"; + const string path = @"D:\file.old"; + const string expect = @"D:\file.new"; Assert.AreEqual(expect, Path.ChangeExtension(path, "new")); Assert.AreEqual(expect, Path.ChangeExtension(path, ".new")); @@ -28,8 +28,8 @@ public void ChangeExtension_changes_extension() [TestMethod] public void ChangeExtension_removes_extension() { - const string path = @"I:\file.old"; - const string expect = @"I:\file"; + const string path = @"D:\file.old"; + const string expect = @"D:\file"; Assert.AreEqual(expect, Path.ChangeExtension(path, null)); } @@ -60,17 +60,17 @@ public void Combine_returns_path1_if_path2_is_empty_string() [TestMethod] public void Combine_combines_paths() { - var expect = @"I:\Path1\Path2\File.ext"; + var expect = @"D:\Path1\Path2\File.ext"; - Assert.AreEqual(expect, Path.Combine(@"I:\Path1", @"Path2\File.ext")); - Assert.AreEqual(expect, Path.Combine(@"I:\Path1\", @"Path2\File.ext")); + Assert.AreEqual(expect, Path.Combine(@"D:\Path1", @"Path2\File.ext")); + Assert.AreEqual(expect, Path.Combine(@"D:\Path1\", @"Path2\File.ext")); } [TestMethod] public void Combine_returns_path2_if_it_is_an_absolute_path() { - var path1 = @"I:\Directory"; - var path2 = @"I:\Absolute\Path"; + var path1 = @"D:\Directory"; + var path2 = @"D:\Absolute\Path"; var actual = Path.Combine(path1, path2); @@ -97,14 +97,14 @@ public void Combine_throws_if_path1_is_null() [TestMethod] public void Combine_throws_if_path2_is_null() { - Assert.ThrowsException(typeof(ArgumentNullException), () => { Path.Combine(@"I:\Directory", null); }); + Assert.ThrowsException(typeof(ArgumentNullException), () => { Path.Combine(@"D:\Directory", null); }); } [TestMethod] public void GetDirectoryName_returns_directory() { - var tests = new[] { @"I:\directory", @"I:\directory\", @"I:\directory\file.ext" }; - var answers = new[] { @"I:\", @"I:\directory", @"I:\directory" }; + var tests = new[] { @"D:\directory", @"D:\directory\", @"D:\directory\file.ext" }; + var answers = new[] { @"D:\", @"D:\directory", @"D:\directory" }; for (var i = 0; i < tests.Length; i++) { @@ -175,9 +175,9 @@ public void GetExtension_returns_extension() var expect = ".ext"; Assert.AreEqual(expect, Path.GetExtension(file)); - Assert.AreEqual(expect, Path.GetExtension($"I:{file}")); - Assert.AreEqual(expect, Path.GetExtension(@$"I:\{file}")); - Assert.AreEqual(expect, Path.GetExtension(@$"I:\directory\{file}")); + Assert.AreEqual(expect, Path.GetExtension($"D:{file}")); + Assert.AreEqual(expect, Path.GetExtension(@$"D:\{file}")); + Assert.AreEqual(expect, Path.GetExtension(@$"D:\directory\{file}")); Assert.AreEqual(expect, Path.GetExtension(@$"\{file}")); } @@ -200,17 +200,17 @@ public void GetExtension_returns_null() [TestMethod] public void GetFilename_returns_empty_string() { - Assert.AreEqual(string.Empty, Path.GetFileName("I:")); - Assert.AreEqual(string.Empty, Path.GetFileName(@"I:\")); + Assert.AreEqual(string.Empty, Path.GetFileName("D:")); + Assert.AreEqual(string.Empty, Path.GetFileName(@"D:\")); } [TestMethod] public void GetFilename_returns_filename_without_extension() { - Assert.AreEqual("file", Path.GetFileName(@"I:\directory\file")); - Assert.AreEqual("file.ext", Path.GetFileName(@"I:\directory\file.ext")); - Assert.AreEqual("file", Path.GetFileName(@"I:\file")); - Assert.AreEqual("file.ext", Path.GetFileName(@"I:\file.ext")); + Assert.AreEqual("file", Path.GetFileName(@"D:\directory\file")); + Assert.AreEqual("file.ext", Path.GetFileName(@"D:\directory\file.ext")); + Assert.AreEqual("file", Path.GetFileName(@"D:\file")); + Assert.AreEqual("file.ext", Path.GetFileName(@"D:\file.ext")); } [TestMethod] @@ -229,17 +229,17 @@ public void GetFilename_returns_null() [TestMethod] public void GetFilenameWithoutExtension_returns_empty_string() { - Assert.AreEqual(string.Empty, Path.GetFileNameWithoutExtension("I:")); - Assert.AreEqual(string.Empty, Path.GetFileNameWithoutExtension(@"I:\")); + Assert.AreEqual(string.Empty, Path.GetFileNameWithoutExtension("D:")); + Assert.AreEqual(string.Empty, Path.GetFileNameWithoutExtension(@"D:\")); } [TestMethod] public void GetFilenameWithoutExtension_returns_filename_without_extension() { - Assert.AreEqual("file", Path.GetFileNameWithoutExtension(@"I:\directory\file")); - Assert.AreEqual("file", Path.GetFileNameWithoutExtension(@"I:\directory\file.ext")); - Assert.AreEqual("file", Path.GetFileNameWithoutExtension(@"I:\file")); - Assert.AreEqual("file", Path.GetFileNameWithoutExtension(@"I:\file.ext")); + Assert.AreEqual("file", Path.GetFileNameWithoutExtension(@"D:\directory\file")); + Assert.AreEqual("file", Path.GetFileNameWithoutExtension(@"D:\directory\file.ext")); + Assert.AreEqual("file", Path.GetFileNameWithoutExtension(@"D:\file")); + Assert.AreEqual("file", Path.GetFileNameWithoutExtension(@"D:\file.ext")); } [TestMethod] @@ -276,10 +276,10 @@ public void GetPathRoot_returns_root() { var tests = new[] { - "I:", @"I:\directory\file", @"I:\directory\file.ext", @"I:\file", @"I:\file.ext" + "D:", @"D:\directory\file", @"D:\directory\file.ext", @"D:\file", @"D:\file.ext" }; - var answers = new[] { "I:", @"I:\", @"I:\", @"I:\", @"I:\" }; + var answers = new[] { "D:", @"D:\", @"D:\", @"D:\", @"D:\" }; for (var i = 0; i < tests.Length; i++) { @@ -316,7 +316,7 @@ public void HasExtension_returns_false() { var tests = new[] { - "file", @"\file.", @"\", "/", "I:", @"I:\", @"I:\directory\" + "file", @"\file.", @"\", "/", "D:", @"D:\", @"D:\directory\" }; for (var i = 0; i < tests.Length; i++) @@ -346,7 +346,7 @@ public void HasExtension_returns_true() { var tests = new[] { - "file.ext", @"\file.ext", "/file.ext", "I:file.ext", @"I:\file.ext", @"I:\directory\file.ext" + "file.ext", @"\file.ext", "/file.ext", "D:file.ext", @"D:\file.ext", @"D:\directory\file.ext" }; for (var i = 0; i < tests.Length; i++) @@ -376,7 +376,7 @@ public void IsPathRooted_returns_true() { var tests = new[] { - @"\", "/", "I:", @"I:\", @"I:\file.ext", @"I:\directory\file.ext" + @"\", "/", "D:", @"D:\", @"D:\file.ext", @"D:\directory\file.ext" }; for (var i = 0; i < tests.Length; i++) diff --git a/System.IO.FileSystem.UnitTests/nano.runsettings b/System.IO.FileSystem.UnitTests/nano.runsettings index 438c21c..373c40d 100644 --- a/System.IO.FileSystem.UnitTests/nano.runsettings +++ b/System.IO.FileSystem.UnitTests/nano.runsettings @@ -1,17 +1,24 @@ - - - .\TestResults - 120000 - net48 - x64 - - - None - True - COM3 - - - + + + + .\TestResults + + 120000 + net48 + x64 + + + + None + + True + + + + + + + \ No newline at end of file diff --git a/System.IO.FileSystem/FileStream.cs b/System.IO.FileSystem/FileStream.cs index 28fdc88..577fefc 100644 --- a/System.IO.FileSystem/FileStream.cs +++ b/System.IO.FileSystem/FileStream.cs @@ -546,12 +546,12 @@ public override void WriteByte(byte value) [Diagnostics.DebuggerStepThrough] [Diagnostics.DebuggerHidden] [MethodImpl(MethodImplOptions.InternalCall)] - private extern int ReadNative(string path, string fileName, long actualPosition, byte[] buffer, int length); + private extern int ReadNative(string path, string fileName, long actualPosition, byte[] buffer, long length); [Diagnostics.DebuggerStepThrough] [Diagnostics.DebuggerHidden] [MethodImpl(MethodImplOptions.InternalCall)] - private extern void WriteNative(string path, string fileName, long actualPosition, byte[] buffer, int length); + private extern void WriteNative(string path, string fileName, long actualPosition, byte[] buffer, long length); [Diagnostics.DebuggerStepThrough] [Diagnostics.DebuggerHidden]