public void RequestsTheCorrectUrlWithRepositoryId() { var connection = Substitute.For <IApiConnection>(); var client = new RepositoryBranchesClient(connection); const string previewAcceptsHeader = "application/vnd.github.loki-preview+json"; client.DeleteBranchProtection(1, "branch"); connection.Connection.Received() .Delete(Arg.Is <Uri>(u => u.ToString() == "repositories/1/branches/branch/protection"), Arg.Any <object>(), previewAcceptsHeader); }
public async Task EnsuresNonNullArguments() { var client = new RepositoryBranchesClient(Substitute.For <IApiConnection>()); await Assert.ThrowsAsync <ArgumentNullException>(() => client.DeleteBranchProtection(null, "repo", "branch")); await Assert.ThrowsAsync <ArgumentNullException>(() => client.DeleteBranchProtection("owner", null, "branch")); await Assert.ThrowsAsync <ArgumentNullException>(() => client.DeleteBranchProtection("owner", "repo", null)); await Assert.ThrowsAsync <ArgumentNullException>(() => client.DeleteBranchProtection(1, null)); await Assert.ThrowsAsync <ArgumentException>(() => client.DeleteBranchProtection("", "repo", "branch")); await Assert.ThrowsAsync <ArgumentException>(() => client.DeleteBranchProtection("owner", "", "branch")); await Assert.ThrowsAsync <ArgumentException>(() => client.DeleteBranchProtection("owner", "repo", "")); await Assert.ThrowsAsync <ArgumentException>(() => client.DeleteBranchProtection(1, "")); }
public async Task EnsuresNonNullArguments() { var client = new RepositoryBranchesClient(Substitute.For<IApiConnection>()); await Assert.ThrowsAsync<ArgumentNullException>(() => client.DeleteBranchProtection(null, "repo", "branch")); await Assert.ThrowsAsync<ArgumentNullException>(() => client.DeleteBranchProtection("owner", null, "branch")); await Assert.ThrowsAsync<ArgumentNullException>(() => client.DeleteBranchProtection("owner", "repo", null)); await Assert.ThrowsAsync<ArgumentNullException>(() => client.DeleteBranchProtection(1, null)); await Assert.ThrowsAsync<ArgumentException>(() => client.DeleteBranchProtection("", "repo", "branch")); await Assert.ThrowsAsync<ArgumentException>(() => client.DeleteBranchProtection("owner", "", "branch")); await Assert.ThrowsAsync<ArgumentException>(() => client.DeleteBranchProtection("owner", "repo", "")); await Assert.ThrowsAsync<ArgumentException>(() => client.DeleteBranchProtection(1, "")); }
public void RequestsTheCorrectUrlWithRepositoryId() { var connection = Substitute.For<IApiConnection>(); var client = new RepositoryBranchesClient(connection); const string previewAcceptsHeader = "application/vnd.github.loki-preview+json"; client.DeleteBranchProtection(1, "branch"); connection.Connection.Received() .Delete(Arg.Is<Uri>(u => u.ToString() == "repositories/1/branches/branch/protection"), Arg.Any<object>(), previewAcceptsHeader); }