public async Task EnsuresArguments() { var client = new ObservableStarredClient(Substitute.For<IGitHubClient>()); await AssertEx.Throws<ArgumentException>(async () => await client.CheckStarred(null, "james")); await AssertEx.Throws<ArgumentException>(async () => await client.CheckStarred("james", null)); }
public async Task EnsuresArguments() { var client = new ObservableStarredClient(Substitute.For<IGitHubClient>()); await AssertEx.Throws<ArgumentException>(async () => await client.GetAllStargazers(null, "name")); await AssertEx.Throws<ArgumentException>(async () => await client.GetAllStargazers("owner", null)); }
public void GetsStarsForUser() { var connection = Substitute.For<IConnection>(); var gitHubClient = Substitute.For<IGitHubClient>(); gitHubClient.Connection.Returns(connection); var client = new ObservableStarredClient(gitHubClient); client.GetAllForUser("jugglingnutcase"); connection.Received().GetAsync<List<Repository>>(ApiUrls.StarredByUser("jugglingnutcase"), null, null); }
public void GetsStargazersFromClient() { var connection = Substitute.For<IConnection>(); var gitHubClient = Substitute.For<IGitHubClient>(); gitHubClient.Connection.Returns(connection); var client = new ObservableStarredClient(gitHubClient); client.GetAllStargazers("jugglingnutcase", "katiejamie"); connection.Received().GetAsync<List<User>>(ApiUrls.Stargazers("jugglingnutcase", "katiejamie"), null, null); }
public async Task ChecksStarredForUser() { var gitHubClient = Substitute.For<IGitHubClient>(); var client = new ObservableStarredClient(gitHubClient); client.CheckStarred("jugglingnutcase", "katiejamie"); gitHubClient.Activity.Starring.Received().CheckStarred("jugglingnutcase", "katiejamie"); }