public async Task EnsuresNonNullArguments() { var client = new ObservableRepositoryBranchesClient(Substitute.For<IGitHubClient>()); var update = new BranchProtectionSettingsUpdate( new BranchProtectionRequiredStatusChecksUpdate(true, true, new[] { "test" })); Assert.Throws<ArgumentNullException>(() => client.UpdateBranchProtection(null, "repo", "branch", update)); Assert.Throws<ArgumentNullException>(() => client.UpdateBranchProtection("owner", null, "branch", update)); Assert.Throws<ArgumentNullException>(() => client.UpdateBranchProtection("owner", "repo", null, update)); Assert.Throws<ArgumentNullException>(() => client.UpdateBranchProtection("owner", "repo", "branch", null)); Assert.Throws<ArgumentNullException>(() => client.UpdateBranchProtection(1, null, update)); Assert.Throws<ArgumentNullException>(() => client.UpdateBranchProtection(1, "branch", null)); Assert.Throws<ArgumentException>(() => client.UpdateBranchProtection("", "repo", "branch", update)); Assert.Throws<ArgumentException>(() => client.UpdateBranchProtection("owner", "", "branch", update)); Assert.Throws<ArgumentException>(() => client.UpdateBranchProtection("owner", "repo", "", update)); Assert.Throws<ArgumentException>(() => client.UpdateBranchProtection(1, "", update)); }
public void RequestsTheCorrectUrlWithRepositoryId() { var gitHubClient = Substitute.For<IGitHubClient>(); var client = new ObservableRepositoryBranchesClient(gitHubClient); var update = new BranchProtectionSettingsUpdate( new BranchProtectionRequiredStatusChecksUpdate(true, true, new[] { "test" })); client.UpdateBranchProtection(1, "branch", update); gitHubClient.Repository.Branch.Received() .UpdateBranchProtection(1, "branch", update); }