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:
authorCarlos Martín Nieto <cmn@dwim.me>2014-05-29 13:31:55 +0400
committernulltoken <emeric.fermas@gmail.com>2014-05-30 20:37:26 +0400
commita9e1523b6248a0fb8bdc3bbcebc136ca7971d26d (patch)
tree24b386662bb799ccb4a23c195f4f7f190b885f01 /LibGit2Sharp.Tests
parent9b0b947874dbbd58c70972683f3dc4a2995f3d50 (diff)
ObjectDatabase: stream objects when we know we can
When given a size and no path, we know that we do not need to buffer the content or apply any filters, so we can create an write-stream into the object database and put in our content directly, avoiding the temporary file and callbacks altogether.
Diffstat (limited to 'LibGit2Sharp.Tests')
-rw-r--r--LibGit2Sharp.Tests/ObjectDatabaseFixture.cs10
1 files changed, 6 insertions, 4 deletions
diff --git a/LibGit2Sharp.Tests/ObjectDatabaseFixture.cs b/LibGit2Sharp.Tests/ObjectDatabaseFixture.cs
index 88b9c12a..b0d622ee 100644
--- a/LibGit2Sharp.Tests/ObjectDatabaseFixture.cs
+++ b/LibGit2Sharp.Tests/ObjectDatabaseFixture.cs
@@ -137,9 +137,11 @@ namespace LibGit2Sharp.Tests
}
[Theory]
- [InlineData(16, 32)]
- [InlineData(7854, 9785)]
- public void CreatingABlobFromTooShortAStreamThrows(int contentSize, int numberOfBytesToConsume)
+ [InlineData(16, 32, null)]
+ [InlineData(7854, 9785, null)]
+ [InlineData(16, 32, "binary.bin")]
+ [InlineData(7854, 9785, "binary.bin")]
+ public void CreatingABlobFromTooShortAStreamThrows(int contentSize, int numberOfBytesToConsume, string hintpath)
{
string path = InitNewRepository();
@@ -147,7 +149,7 @@ namespace LibGit2Sharp.Tests
{
using (var stream = PrepareMemoryStream(contentSize))
{
- Assert.Throws<EndOfStreamException>(() => repo.ObjectDatabase.CreateBlob(stream, numberOfBytesToConsume: numberOfBytesToConsume));
+ Assert.Throws<EndOfStreamException>(() => repo.ObjectDatabase.CreateBlob(stream, hintpath, numberOfBytesToConsume));
}
}
}