diff options
author | Keith Dahlby <dahlbyk@gmail.com> | 2013-03-02 23:07:20 +0400 |
---|---|---|
committer | nulltoken <emeric.fermas@gmail.com> | 2013-03-26 02:01:21 +0400 |
commit | 7b6d5bc8c08028c6fada6724a5517b24ff5ec8c8 (patch) | |
tree | a0d32778ec36dd043ee925af9fe84040f1fcfa0d /LibGit2Sharp.Tests/ObjectIdFixture.cs | |
parent | b76cf61a155801ee54f8f6458686121cd1e06ea5 (diff) |
Add explicit cast from string to ObjectId
Diffstat (limited to 'LibGit2Sharp.Tests/ObjectIdFixture.cs')
-rw-r--r-- | LibGit2Sharp.Tests/ObjectIdFixture.cs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/LibGit2Sharp.Tests/ObjectIdFixture.cs b/LibGit2Sharp.Tests/ObjectIdFixture.cs index 280c0372..7af64a35 100644 --- a/LibGit2Sharp.Tests/ObjectIdFixture.cs +++ b/LibGit2Sharp.Tests/ObjectIdFixture.cs @@ -40,6 +40,24 @@ namespace LibGit2Sharp.Tests } [Fact] + public void CanCastShaToObjectId() + { + var id = (ObjectId)validSha1; + + Assert.Equal(bytes, id.RawId); + } + + [Fact] + public void CanCastNullToObjectId() + { + string sha = null; + + var id = (ObjectId)sha; + + Assert.Null(id); + } + + [Fact] public void CreatingObjectIdWithWrongNumberOfBytesThrows() { var invalidBytes = new byte[] { 206, 8, 254, 72, 132, 101, 15, 6, 123, 213, 112, 59, 106, 89, 168, 179, 179, 201, 154 }; |