Skip to content

Commit 7974c80

Browse files
committed
ObjectDatabase: test Writeing a blob
Test that we can `ObjectDatabase.Write` a blob.
1 parent 97b3951 commit 7974c80

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

LibGit2Sharp.Tests/ObjectDatabaseFixture.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,18 @@ public void CanCreateABlobFromAStream(string expectedSha, string hintPath)
121121
}
122122
}
123123

124+
[Fact]
125+
public void CanWriteABlobFromAByteArray()
126+
{
127+
var ba = Encoding.ASCII.GetBytes("libgit2\r\n");
128+
129+
using (var repo = new Repository(InitNewRepository()))
130+
{
131+
var id = repo.ObjectDatabase.Write<Blob>(ba);
132+
Assert.Equal(new ObjectId("99115ea359379a218c47cffc83cd0af8c91c4061"), id);
133+
}
134+
}
135+
124136
Stream PrepareMemoryStream(int contentSize)
125137
{
126138
var sb = new StringBuilder();

0 commit comments

Comments
 (0)