Observable Client tests

This commit is contained in:
Amy Palamountain
2014-01-11 11:06:22 +13:00
parent fd7133574b
commit 6a66bf9a1e
3 changed files with 42 additions and 1 deletions
+1
View File
@@ -145,6 +145,7 @@
<Compile Include="Reactive\ObservableReleasesClientTests.cs" />
<Compile Include="Reactive\ObservableRepositoriesClientTests.cs" />
<Compile Include="Reactive\ObservableStarredClientTests.cs" />
<Compile Include="Reactive\ObservableStatisticsClientTests.cs" />
<Compile Include="Reactive\ObservableTreesClientTests.cs" />
<Compile Include="Reactive\ObservableFollowersTest.cs" />
<Compile Include="Reactive\ObservableUserEmailsClientTests.cs" />
@@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Reactive.Linq;
using System.Threading.Tasks;
using NSubstitute;
using Octokit;
using Octokit.Internal;
using Octokit.Reactive;
using Octokit.Tests.Helpers;
@@ -0,0 +1,41 @@
using System;
using System.Reactive.Linq;
using System.Threading.Tasks;
using NSubstitute;
using Octokit.Reactive;
using Octokit.Tests.Helpers;
using Xunit;
namespace Octokit.Tests.Reactive
{
public class ObservableStatisticsClientTests
{
public class TheGetMethod
{
[Fact]
public void GetsFromClientIssueMilestone()
{
var gitHubClient = Substitute.For<IGitHubClient>();
var statisticsClient = new ObservableStatisticsClient(gitHubClient);
statisticsClient.GetContributors("username", "repositoryName");
gitHubClient.Statistics.Received().GetContributors("username", "repositoryName");
}
[Fact]
public async Task ThrowsIfGivenNullRepositoryName()
{
var statisticsClient = new ObservableStatisticsClient(Substitute.For<IGitHubClient>());
await AssertEx.Throws<ArgumentNullException>(async () => await statisticsClient.GetContributors("owner", null));
}
[Fact]
public async Task ThrowsIfGivenNullOwnerName()
{
var statisticsClient = new ObservableStatisticsClient(Substitute.For<IGitHubClient>());
await AssertEx.Throws<ArgumentNullException>(async () => await statisticsClient.GetContributors(null, "repositoryName"));
}
}
}
}