Skip to content

Commit

Permalink
Changed test to verify handling of readonly lists
Browse files Browse the repository at this point in the history
  • Loading branch information
khellang committed Jan 4, 2015
1 parent 9e2bfb6 commit 619a282
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 16 deletions.
23 changes: 11 additions & 12 deletions Octokit.Tests.Integration/Clients/CommitStatusClientTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Linq;
using System.Threading.Tasks;
using Octokit;
using Octokit.Tests.Integration;
Expand Down Expand Up @@ -30,19 +31,17 @@ public class TheGetCombinedMethod
[IntegrationTest]
public async Task CanRetrieveCombinedStatus()
{
var githubClient = new GitHubClient(new ProductHeaderValue("OctokitTests"))
{
Credentials = Helper.Credentials
};
var githubClient = Helper.GetAuthenticatedClient();
var status = await githubClient.Repository.CommitStatus.GetCombined(
"rails",
"rails",
"94b857899506612956bb542e28e292308accb908");
Assert.Equal(CommitState.Failure, status.State);
Assert.Equal("94b857899506612956bb542e28e292308accb908", status.Sha);
Assert.Equal(1, status.TotalCount);
Assert.Equal(CommitState.Failure, status.Statuses[0].State);
Assert.Equal("The Travis CI build failed", status.Statuses[0].Description);
"libgit2",
"libgit2sharp",
"f54529997b6ad841be524654d9e9074ab8e7d41d");
Assert.Equal(CommitState.Success, status.State);
Assert.Equal("f54529997b6ad841be524654d9e9074ab8e7d41d", status.Sha);
Assert.Equal(2, status.TotalCount);
Assert.Equal(2, status.Statuses.Count);
Assert.True(status.Statuses.All(x => x.State == CommitState.Success));
Assert.Equal("The Travis CI build passed", status.Statuses[0].Description);
}
}

Expand Down
5 changes: 1 addition & 4 deletions Octokit/Models/Response/CombinedCommitStatus.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;

namespace Octokit
Expand All @@ -26,9 +25,7 @@ public class CombinedCommitStatus
/// <summary>
/// The statuses.
/// </summary>
// TODO: This ought to be an IReadOnlyList<ApiErrorDetail> but we need to add support to SimpleJson for that.
[SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public IList<CommitStatus> Statuses { get; protected set; }
public IReadOnlyList<CommitStatus> Statuses { get; protected set; }

/// <summary>
/// The repository of the reference.
Expand Down

0 comments on commit 619a282

Please sign in to comment.