Replaced public properties by readonly fields with a public getter and cleaned code

This commit is contained in:
Gabriel Weyer
2013-11-24 19:06:59 +11:00
parent ceb943c550
commit 921353dd4b
9 changed files with 146 additions and 151 deletions

View File

@@ -4,25 +4,48 @@ namespace Octokit
{
public class PullRequestReviewCommentCreate : RequestParameters
{
private readonly string _body;
private readonly string _commitId;
private readonly string _path;
private readonly int _position;
/// <summary>
/// The text of the comment.
/// </summary>
public string Body { get; set; }
public string Body { get { return _body; } }
/// <summary>
/// The SHA of the commit to comment on.
/// </summary>
[Parameter(Key = "commit_id")]
public string CommitId { get; set; }
public string CommitId { get { return _commitId; } }
/// <summary>
/// The relative path of the file to comment on.
/// </summary>
public string Path { get; set; }
public string Path { get { return _path; } }
/// <summary>
/// The line index in the diff to comment on.
/// </summary>
public int Position { get; set; }
public int Position { get { return _position; } }
/// <summary>
/// Creates a comment
/// </summary>
/// <param name="body">The text of the comment</param>
/// <param name="commitId">The SHA of the commit to comment on</param>
/// <param name="path">The relative path of the file to comment on</param>
/// <param name="position">The line index in the diff to comment on</param>
public PullRequestReviewCommentCreate(string body, string commitId, string path, int position)
{
Ensure.ArgumentNotNullOrEmptyString(body, "body");
Ensure.ArgumentNotNullOrEmptyString(commitId, "commitId");
Ensure.ArgumentNotNullOrEmptyString(path, "path");
_body = body;
_commitId = commitId;
_path = path;
_position = position;
}
}
}