Use GitReference across multiple types

This commit is contained in:
John Nye
2013-11-07 18:29:22 +00:00
parent 8b904ca0b1
commit 449cd1e4e2
8 changed files with 16 additions and 18 deletions
@@ -21,10 +21,10 @@ namespace Octokit.Tests.Integration
var repoName = Helper.MakeNameWithTimestamp("public-repo");
this._commitsClient = this._gitHubClient.GitDatabase.Commit;
this._repository = this._gitHubClient.Repository.Create(new NewRepository { Name = repoName }).Result;
this._repository = this._gitHubClient.Repository.Create(new NewRepository { Name = repoName, AutoInit = true }).Result;
}
[IntegrationTest(Skip = "Requires additional repository setup")]
[IntegrationTest]
public async Task CanCreateAndRetrieveCommit()
{
string owner = this._repository.Owner.Login;
+1 -9
View File
@@ -2,20 +2,12 @@
namespace Octokit
{
public class Commit
public class Commit : GitReference
{
public string Sha { get; set; }
public string Url { get; set; }
public string Message { get; set; }
public UserAction Author { get; set; }
public UserAction Committer { get; set; }
public GitReference Tree { get; set; }
public IEnumerable<GitReference> Parents { get; set; }
}
public class GitReference
{
public string Url { get; set; }
public string Sha { get; set; }
}
}
+8
View File
@@ -0,0 +1,8 @@
namespace Octokit
{
public class GitReference
{
public string Url { get; set; }
public string Sha { get; set; }
}
}
+1 -3
View File
@@ -1,10 +1,8 @@
namespace Octokit
{
public class GitTag
public class GitTag : GitReference
{
public string Tag { get; set; }
public string Sha { get; set; }
public string Url { get; set; }
public string Message { get; set; }
public UserAction Tagger { get; set; }
public TagObject Object { get; set; }
+1 -4
View File
@@ -1,12 +1,10 @@
namespace Octokit
{
public class TagObject
public class TagObject : GitReference
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1721:PropertyNamesShouldNotMatchGetMethods",
Justification = "Name defined by web api and required for deserialisation")]
public TaggedType Type { get; set; }
public string Sha { get; set; }
public string Url { get; set; }
}
/// <summary>
@@ -18,5 +16,4 @@
Blob,
Tree
}
}
+1
View File
@@ -77,6 +77,7 @@
<Compile Include="Models\Response\Activity.cs" />
<Compile Include="Models\Response\CommitStatus.cs" />
<Compile Include="Models\Response\EventInfo.cs" />
<Compile Include="Models\Response\GitReference.cs" />
<Compile Include="Models\Response\GitTag.cs" />
<Compile Include="Models\Response\Issue.cs" />
<Compile Include="Models\Request\IssueRequest.cs" />
+1
View File
@@ -166,6 +166,7 @@
<Compile Include="Models\Response\Commit.cs" />
<Compile Include="Models\Response\CommitStatus.cs" />
<Compile Include="Models\Response\EmailAddress.cs" />
<Compile Include="Models\Response\GitReference.cs" />
<Compile Include="Models\Response\GitTag.cs" />
<Compile Include="Models\Response\EventInfo.cs" />
<Compile Include="Models\Response\Issue.cs" />
+1
View File
@@ -88,6 +88,7 @@
<Compile Include="Models\Response\Commit.cs" />
<Compile Include="Models\Response\CommitStatus.cs" />
<Compile Include="Models\Response\EventInfo.cs" />
<Compile Include="Models\Response\GitReference.cs" />
<Compile Include="Models\Response\Issue.cs" />
<Compile Include="Models\Request\IssueRequest.cs" />
<Compile Include="Models\Request\IssueUpdate.cs" />