public ObservableRepositoriesClient(IGitHubClient client) { Ensure.ArgumentNotNull(client, nameof(client)); _client = client.Repository; _connection = client.Connection; Status = new ObservableCommitStatusClient(client); Hooks = new ObservableRepositoryHooksClient(client); Forks = new ObservableRepositoryForksClient(client); Collaborator = new ObservableRepoCollaboratorsClient(client); Deployment = new ObservableDeploymentsClient(client); Statistics = new ObservableStatisticsClient(client); PullRequest = new ObservablePullRequestsClient(client); Branch = new ObservableRepositoryBranchesClient(client); Comment = new ObservableRepositoryCommentsClient(client); Commit = new ObservableRepositoryCommitsClient(client); Release = new ObservableReleasesClient(client); DeployKeys = new ObservableRepositoryDeployKeysClient(client); Content = new ObservableRepositoryContentsClient(client); Merging = new ObservableMergingClient(client); Page = new ObservableRepositoryPagesClient(client); Invitation = new ObservableRepositoryInvitationsClient(client); Traffic = new ObservableRepositoryTrafficClient(client); Project = new ObservableProjectsClient(client); }
public async Task EnsuresNonNullArguments() { var releasesClient = new ObservableReleasesClient(Substitute.For<IGitHubClient>()); await AssertEx.Throws<ArgumentNullException>(async () => await releasesClient.GetAll(null, "name")); await AssertEx.Throws<ArgumentNullException>(async () => await releasesClient.GetAll("owner", null)); }
public void EnsuresNonNullArguments() { var releasesClient = new ObservableReleasesClient(Substitute.For<IGitHubClient>()); Assert.Throws<ArgumentNullException>(() => releasesClient.GetAll(null, "name")); Assert.Throws<ArgumentNullException>(() => releasesClient.GetAll("owner", null)); }
public ObservableRepositoriesClient(IGitHubClient client) { Ensure.ArgumentNotNull(client, "client"); _client = client.Repository; _connection = client.Connection; Status = new ObservableCommitStatusClient(client); Hooks = new ObservableRepositoryHooksClient(client); Forks = new ObservableRepositoryForksClient(client); #pragma warning disable CS0618 // Type or member is obsolete RepoCollaborators = new ObservableRepoCollaboratorsClient(client); #pragma warning restore CS0618 // Type or member is obsolete Collaborator = new ObservableRepoCollaboratorsClient(client); Deployment = new ObservableDeploymentsClient(client); Statistics = new ObservableStatisticsClient(client); PullRequest = new ObservablePullRequestsClient(client); #pragma warning disable CS0618 // Type or member is obsolete RepositoryComments = new ObservableRepositoryCommentsClient(client); #pragma warning restore CS0618 // Type or member is obsolete Comment = new ObservableRepositoryCommentsClient(client); #pragma warning disable CS0618 // Type or member is obsolete Commits = new ObservableRepositoryCommitsClient(client); #pragma warning restore CS0618 // Type or member is obsolete Commit = new ObservableRepositoryCommitsClient(client); Release = new ObservableReleasesClient(client); DeployKeys = new ObservableRepositoryDeployKeysClient(client); Content = new ObservableRepositoryContentsClient(client); Merging = new ObservableMergingClient(client); Page = new ObservableRepositoryPagesClient(client); }
public void CallsIntoClient() { var gitHubClient = Substitute.For<IGitHubClient>(); var client = new ObservableReleasesClient(gitHubClient); client.GetLatest("fake", "repo"); gitHubClient.Repository.Release.Received(1).GetLatest("fake", "repo"); }
public void RequestsTheCorrectUrl() { var gitHubClient = Substitute.For<IGitHubClient>(); var client = new ObservableReleasesClient(gitHubClient); client.Get("fake", "repo", 1); gitHubClient.Connection.GetAsync<IReadOnlyList<Release>>( new Uri("repos/fake/repo/releases/1", UriKind.Relative), null, null); }
public void RequestsTheCorrectUrl() { var gitHubClient = Substitute.For<IGitHubClient>(); var client = new ObservableReleasesClient(gitHubClient); client.GetAll("fake", "repo"); gitHubClient.Connection.Received(1).Get<List<Release>>( new Uri("repos/fake/repo/releases", UriKind.Relative), Args.EmptyDictionary, null); }
public void CallsIntoClient() { var gitHubClient = Substitute.For<IGitHubClient>(); var releasesClient = new ObservableReleasesClient(gitHubClient); var data = new ReleaseUpdate("fake-tag"); releasesClient.CreateRelease("fake", "repo", data); gitHubClient.Release.Received(1).CreateRelease("fake", "repo", data); }
public void RequestsCorrectUrl() { var gitHubClient = Substitute.For<IGitHubClient>(); var releasesClient = new ObservableReleasesClient(gitHubClient); var data = new ReleaseUpdate("fake-tag"); releasesClient.CreateRelease("fake", "repo", data); gitHubClient.Connection.PostAsync<Release>( new Uri("repos/fake/repo/releases", UriKind.Relative), data, null, null); }
public ObservableGitHubClient(IGitHubClient gitHubClient) { Ensure.ArgumentNotNull(gitHubClient, "githubClient"); _gitHubClient = gitHubClient; Authorization = new ObservableAuthorizationsClient(gitHubClient); Miscellaneous = new ObservableMiscellaneousClient(gitHubClient.Miscellaneous); Notification = new ObservableNotificationsClient(gitHubClient); Organization = new ObservableOrganizationsClient(gitHubClient); Repository = new ObservableRepositoriesClient(gitHubClient); SshKey = new ObservableSshKeysClient(gitHubClient); User = new ObservableUsersClient(gitHubClient); Release = new ObservableReleasesClient(gitHubClient); }
public void RequestsTheCorrectUrlWithRepositoryIdWithApiOptions() { var gitHubClient = Substitute.For<IGitHubClient>(); var client = new ObservableReleasesClient(gitHubClient); var options = new ApiOptions { PageCount = 1, PageSize = 1, StartPage = 1 }; client.GetAll(1, options); gitHubClient.Connection.Received(1).Get<List<Release>>( new Uri("repositories/1/releases", UriKind.Relative), Arg.Is<IDictionary<string, string>>(d => d.Count == 2), null); }
public ObservableGitHubClient(IGitHubClient gitHubClient) { Ensure.ArgumentNotNull(gitHubClient, "githubClient"); _gitHubClient = gitHubClient; Authorization = new ObservableAuthorizationsClient(gitHubClient); Activity = new ObservableActivitiesClient(gitHubClient); Issue = new ObservableIssuesClient(gitHubClient); Miscellaneous = new ObservableMiscellaneousClient(gitHubClient.Miscellaneous); Notification = new ObservableNotificationsClient(gitHubClient); Organization = new ObservableOrganizationsClient(gitHubClient); Repository = new ObservableRepositoriesClient(gitHubClient); SshKey = new ObservableSshKeysClient(gitHubClient); User = new ObservableUsersClient(gitHubClient); Release = new ObservableReleasesClient(gitHubClient); GitDatabase = new ObservableGitDatabaseClient(gitHubClient); Gist = new ObservableGistsClient(gitHubClient); Search = new ObservableSearchClient(gitHubClient); }
public ObservableRepositoriesClient(IGitHubClient client) { Ensure.ArgumentNotNull(client, "client"); _client = client.Repository; _connection = client.Connection; Status = new ObservableCommitStatusClient(client); Hooks = new ObservableRepositoryHooksClient(client); Forks = new ObservableRepositoryForksClient(client); Collaborator = new ObservableRepoCollaboratorsClient(client); Deployment = new ObservableDeploymentsClient(client); Statistics = new ObservableStatisticsClient(client); PullRequest = new ObservablePullRequestsClient(client); Comment = new ObservableRepositoryCommentsClient(client); Commit = new ObservableRepositoryCommitsClient(client); Release = new ObservableReleasesClient(client); DeployKeys = new ObservableRepositoryDeployKeysClient(client); Content = new ObservableRepositoryContentsClient(client); Merging = new ObservableMergingClient(client); Page = new ObservableRepositoryPagesClient(client); Invitation = new ObservableRepositoryInvitationsClient(client); }
public void EnsuresNonNullArguments() { var client = new ObservableReleasesClient(Substitute.For<IGitHubClient>()); Assert.Throws<ArgumentNullException>(() => client.DeleteAsset(null, "name", 1)); Assert.Throws<ArgumentException>(() => client.DeleteAsset("", "name", 1)); Assert.Throws<ArgumentNullException>(() => client.DeleteAsset("owner", null, 1)); Assert.Throws<ArgumentException>(() => client.DeleteAsset("owner", "", 1)); }
public void RequestsTheCorrectUrl() { var gitHubClient = Substitute.For<IGitHubClient>(); var client = new ObservableReleasesClient(gitHubClient); client.DeleteAsset("fake", "repo", 1); gitHubClient.Connection.Delete( new Uri("repos/fake/repo/releases/assets/1", UriKind.Relative)); }
public void RequestsTheCorrectUrl() { var gitHubClient = Substitute.For<IGitHubClient>(); var client = new ObservableReleasesClient(gitHubClient); var data = new ReleaseAssetUpdate("asset"); client.EditAsset("fake", "repo", 1, data); gitHubClient.Repository.Release.Received(1).EditAsset("fake", "repo", 1, data); }
public void EnsuresArgumentsNotNull() { var releasesClient = new ObservableReleasesClient(Substitute.For<IGitHubClient>()); var release = new Release("https://uploads.github.com/anything"); var uploadData = new ReleaseAssetUpload("good", "good/good", Stream.Null, null); Assert.Throws<ArgumentNullException>(() => releasesClient.UploadAsset(null, uploadData)); Assert.Throws<ArgumentNullException>(() => releasesClient.UploadAsset(release, null)); }
public void RequestsTheCorrectUrlWithRepositoryId() { var gitHubClient = Substitute.For<IGitHubClient>(); var client = new ObservableReleasesClient(gitHubClient); client.DeleteAsset(1, 1); gitHubClient.Connection.Delete( new Uri("repositories/1/releases/assets/1", UriKind.Relative)); }
public void CallsIntoClient() { var gitHubClient = Substitute.For<IGitHubClient>(); var releasesClient = new ObservableReleasesClient(gitHubClient); var release = new Release("https://uploads.test.dev/does/not/matter/releases/1/assets{?name}"); var rawData = Substitute.For<Stream>(); var upload = new ReleaseAssetUpload("example.zip", "application/zip", rawData, null); releasesClient.UploadAsset(release, upload); gitHubClient.Repository.Release.Received(1).UploadAsset(release, upload); }
public void RequestsTheCorrectUrlWithApiOptions() { var expectedUrl = string.Format("repos/{0}/{1}/releases/1/assets", "fake", "repo"); var gitHubClient = Substitute.For<IGitHubClient>(); var client = new ObservableReleasesClient(gitHubClient); var options = new ApiOptions { StartPage = 1, PageCount = 1, PageSize = 1 }; client.GetAllAssets("fake", "repo", 1, options); gitHubClient.Connection.Received(1).Get<List<ReleaseAsset>>( Arg.Is<Uri>(u => u.ToString() == expectedUrl), Arg.Is<IDictionary<string, string>>(dictionary => dictionary.Count == 2), null); }
public void RequestsTheCorrectUrl() { var gitHubClient = Substitute.For<IGitHubClient>(); var client = new ObservableReleasesClient(gitHubClient); client.Delete("fake", "repo", 1); gitHubClient.Repository.Release.Received(1).Delete("fake", "repo", 1); }
public void EnsuresNonNullArguments() { var releasesClient = new ObservableReleasesClient(Substitute.For<IGitHubClient>()); var update = new ReleaseUpdate { TagName = "tag" }; Assert.Throws<ArgumentNullException>(() => releasesClient.Edit(null, "name", 1, update)); Assert.Throws<ArgumentException>(() => releasesClient.Edit("", "name", 1, update)); Assert.Throws<ArgumentNullException>(() => releasesClient.Edit("owner", null, 1, update)); Assert.Throws<ArgumentException>(() => releasesClient.Edit("owner", "", 1, update)); Assert.Throws<ArgumentNullException>(() => releasesClient.Edit("owner", "name", 1, null)); }
public void RequestsTheCorrectUrlWithRepositoryId() { var gitHubClient = Substitute.For<IGitHubClient>(); var client = new ObservableReleasesClient(gitHubClient); client.GetAsset(1, 1); gitHubClient.Repository.Release.Received(1).GetAsset(1, 1); }
public void RequestsTheCorrectUrlWithRepositoryId() { var gitHubClient = Substitute.For<IGitHubClient>(); var releasesClient = new ObservableReleasesClient(gitHubClient); var data = new NewRelease("fake-tag"); releasesClient.Create(1, data); gitHubClient.Repository.Release.Received(1).Create(1, data); }
public void RequestsTheCorrectUrl() { var gitHubClient = Substitute.For<IGitHubClient>(); var client = new ObservableReleasesClient(gitHubClient); client.GetAssets("fake", "repo", 1); gitHubClient.Connection.Received(1).Get<List<ReleaseAsset>>( new Uri("repos/fake/repo/releases/1/assets", UriKind.Relative), null, null); }
public void EnsuresArgumentsNotNull() { var releasesClient = new ObservableReleasesClient(Substitute.For<IGitHubClient>()); var release = new Release { UploadUrl = "https://uploads.github.com/anything" }; var uploadData = new ReleaseAssetUpload { FileName = "good", ContentType = "good/good", RawData = Stream.Null }; Assert.Throws<ArgumentNullException>(() => releasesClient.UploadAsset(null, uploadData)); Assert.Throws<ArgumentNullException>(() => releasesClient.UploadAsset(release, null)); }
public void CallsIntoClient() { var gitHubClient = Substitute.For<IGitHubClient>(); var releasesClient = new ObservableReleasesClient(gitHubClient); var release = new Release { UploadUrl = "https://uploads.test.dev/does/not/matter/releases/1/assets{?name}" }; var rawData = Substitute.For<Stream>(); var upload = new ReleaseAssetUpload { FileName = "example.zip", ContentType = "application/zip", RawData = rawData }; releasesClient.UploadAsset(release, upload); gitHubClient.Release.Received(1).UploadAsset(release, upload); }
public void RequestsTheCorrectUrl() { var gitHubClient = Substitute.For<IGitHubClient>(); var releasesClient = new ObservableReleasesClient(gitHubClient); var data = new ReleaseUpdate { TagName = "fake-tag" }; releasesClient.Edit("fake", "repo", 1, data); gitHubClient.Repository.Release.Received(1).Edit("fake", "repo", 1, data); }
public void RequestsTheCorrectUrlWithRepositoryId() { var gitHubClient = Substitute.For<IGitHubClient>(); var client = new ObservableReleasesClient(gitHubClient); client.GetAllAssets(1, 1); gitHubClient.Connection.Received(1).Get<List<ReleaseAsset>>( new Uri("repositories/1/releases/1/assets", UriKind.Relative), Args.EmptyDictionary, null); }
public TheGetAllMethod() { var github = Helper.GetAuthenticatedClient(); _releaseClient = new ObservableReleasesClient(github); }
public void EnsuresArgumentsNotNull() { var releasesClient = new ObservableReleasesClient(Substitute.For<IGitHubClient>()); var data = new NewRelease("fake-tag"); Assert.Throws<ArgumentNullException>(() => new NewRelease(null)); Assert.Throws<ArgumentNullException>(() => releasesClient.Create(null, "name", data)); Assert.Throws<ArgumentNullException>(() => releasesClient.Create("owner", null, data)); Assert.Throws<ArgumentNullException>(() => releasesClient.Create("owner", "name", null)); }