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:28:12 +0400
committernulltoken <emeric.fermas@gmail.com>2013-10-27 12:28:52 +0400
commit2bb26a5f6256ca5641f195c2e18905ce8aefa232 (patch)
tree67aaae80a30c05a1ff4e2ddf2a5f593b3e270e08 /LibGit2Sharp.Tests
parent7af5c60f22f9bd6064204f84467cfa62bedd1147 (diff)
Teach BaseFixture.Touch() to accept Streams
Diffstat (limited to 'LibGit2Sharp.Tests')
-rw-r--r--LibGit2Sharp.Tests/TestHelpers/BaseFixture.cs19
1 files changed, 19 insertions, 0 deletions
diff --git a/LibGit2Sharp.Tests/TestHelpers/BaseFixture.cs b/LibGit2Sharp.Tests/TestHelpers/BaseFixture.cs
index 4d076806..5dbdfbda 100644
--- a/LibGit2Sharp.Tests/TestHelpers/BaseFixture.cs
+++ b/LibGit2Sharp.Tests/TestHelpers/BaseFixture.cs
@@ -270,6 +270,25 @@ namespace LibGit2Sharp.Tests.TestHelpers
return filePath;
}
+ protected static string Touch(string parent, string file, Stream stream)
+ {
+ Debug.Assert(stream != null);
+
+ string filePath = Path.Combine(parent, file);
+ string dir = Path.GetDirectoryName(filePath);
+ Debug.Assert(dir != null);
+
+ Directory.CreateDirectory(dir);
+
+ using (var fs = File.Open(filePath, FileMode.Create))
+ {
+ CopyStream(stream, fs);
+ fs.Flush();
+ }
+
+ return filePath;
+ }
+
protected string Expected(string filename)
{
return File.ReadAllText(Path.Combine(ResourcesDirectory.FullName, "expected/" + filename));