Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2sharp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAimeast <lixd3389@gmail.com>2013-10-27 12:31:27 +0400
committernulltoken <emeric.fermas@gmail.com>2013-10-27 12:31:54 +0400
commit36945a94de6545d8e301c4b5921baa3b1d76aec7 (patch)
treea5557f9e0115ba5c2129eae3d5aad5a97ae0510f /LibGit2Sharp.Tests/TestHelpers/BaseFixture.cs
parent2bb26a5f6256ca5641f195c2e18905ce8aefa232 (diff)
Push down Stream related helpers into BaseFixture
Diffstat (limited to 'LibGit2Sharp.Tests/TestHelpers/BaseFixture.cs')
-rw-r--r--LibGit2Sharp.Tests/TestHelpers/BaseFixture.cs26
1 files changed, 26 insertions, 0 deletions
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;
+ }
}
}