diff options
author | Aimeast <lixd3389@gmail.com> | 2013-10-27 12:31:27 +0400 |
---|---|---|
committer | nulltoken <emeric.fermas@gmail.com> | 2013-10-27 12:31:54 +0400 |
commit | 36945a94de6545d8e301c4b5921baa3b1d76aec7 (patch) | |
tree | a5557f9e0115ba5c2129eae3d5aad5a97ae0510f /LibGit2Sharp.Tests | |
parent | 2bb26a5f6256ca5641f195c2e18905ce8aefa232 (diff) |
Push down Stream related helpers into BaseFixture
Diffstat (limited to 'LibGit2Sharp.Tests')
-rw-r--r-- | LibGit2Sharp.Tests/BlobFixture.cs | 26 | ||||
-rw-r--r-- | LibGit2Sharp.Tests/TestHelpers/BaseFixture.cs | 26 |
2 files changed, 26 insertions, 26 deletions
diff --git a/LibGit2Sharp.Tests/BlobFixture.cs b/LibGit2Sharp.Tests/BlobFixture.cs index 8661c871..76b24e31 100644 --- a/LibGit2Sharp.Tests/BlobFixture.cs +++ b/LibGit2Sharp.Tests/BlobFixture.cs @@ -175,32 +175,6 @@ namespace LibGit2Sharp.Tests } } - public static void CopyStream(Stream input, Stream output) - { - // Reused from the following Stack Overflow post with permission - // of Jon Skeet (obtained on 25 Feb 2013) - // http://stackoverflow.com/questions/411592/how-do-i-save-a-stream-to-a-file/411605#411605 - var buffer = new byte[8*1024]; - int len; - while ((len = input.Read(buffer, 0, buffer.Length)) > 0) - { - output.Write(buffer, 0, len); - } - } - - public static bool StreamEquals(Stream one, Stream two) - { - int onebyte, twobyte; - - while ((onebyte = one.ReadByte()) >= 0 && (twobyte = two.ReadByte()) >= 0) - { - if (onebyte != twobyte) - return false; - } - - return true; - } - [Fact] public void CanStageAFileGeneratedFromABlobContentStream() { diff --git a/LibGit2Sharp.Tests/TestHelpers/BaseFixture.cs b/LibGit2Sharp.Tests/TestHelpers/BaseFixture.cs index 5dbdfbda..0c8dbbc8 100644 --- a/LibGit2Sharp.Tests/TestHelpers/BaseFixture.cs +++ b/LibGit2Sharp.Tests/TestHelpers/BaseFixture.cs @@ -324,5 +324,31 @@ namespace LibGit2Sharp.Tests.TestHelpers { repository.Config.Set("core.logAllRefUpdates", enable); } + + public static void CopyStream(Stream input, Stream output) + { + // Reused from the following Stack Overflow post with permission + // of Jon Skeet (obtained on 25 Feb 2013) + // http://stackoverflow.com/questions/411592/how-do-i-save-a-stream-to-a-file/411605#411605 + var buffer = new byte[8 * 1024]; + int len; + while ((len = input.Read(buffer, 0, buffer.Length)) > 0) + { + output.Write(buffer, 0, len); + } + } + + public static bool StreamEquals(Stream one, Stream two) + { + int onebyte, twobyte; + + while ((onebyte = one.ReadByte()) >= 0 && (twobyte = two.ReadByte()) >= 0) + { + if (onebyte != twobyte) + return false; + } + + return true; + } } } |