public async Task RequestsCorrectUrlWithRepositoryId() { var gitHubClient = Substitute.For <IGitHubClient>(); var client = new ObservableIssuesLabelsClient(gitHubClient); client.Get(1, "label"); gitHubClient.Issue.Labels.Received().Get(1, "label"); }
public void DeletesCorrectUrlWithRepositoryId() { var gitHubClient = Substitute.For <IGitHubClient>(); var client = new ObservableIssuesLabelsClient(gitHubClient); client.Delete(1, "labelName"); gitHubClient.Received().Issue.Labels.Delete(1, "labelName"); }
public void PostsToCorrectUrl() { var gitHubClient = Substitute.For <IGitHubClient>(); var client = new ObservableIssuesLabelsClient(gitHubClient); client.AddToIssue("fake", "repo", 42, labels); gitHubClient.Issue.Labels.Received().AddToIssue("fake", "repo", 42, labels); }
public void PutsToCorrectUrlWithRepositoryId() { var gitHubClient = Substitute.For <IGitHubClient>(); var client = new ObservableIssuesLabelsClient(gitHubClient); client.ReplaceAllForIssue(1, 42, labels); gitHubClient.Issue.Labels.Received().ReplaceAllForIssue(1, 42, labels); }
public async Task EnsuresNonNullArguments() { var client = new ObservableIssuesLabelsClient(Substitute.For <IGitHubClient>()); Assert.Throws <ArgumentNullException>(() => client.RemoveAllFromIssue(null, "name", 42)); Assert.Throws <ArgumentNullException>(() => client.RemoveAllFromIssue("owner", null, 42)); Assert.Throws <ArgumentException>(() => client.RemoveAllFromIssue("", "name", 42)); Assert.Throws <ArgumentException>(() => client.RemoveAllFromIssue("owner", "", 42)); }
public void DeletesCorrectUrlWithRepositoryId() { var connection = Substitute.For <IConnection>(); var gitHubClient = new GitHubClient(connection); var client = new ObservableIssuesLabelsClient(gitHubClient); client.RemoveAllFromIssue(1, 42); connection.Received().Delete(Arg.Is <Uri>(u => u.ToString() == "repositories/1/issues/42/labels")); }
public async Task RequestsCorrectUrl() { var connection = Substitute.For <IConnection>(); var gitHubClient = new GitHubClient(connection); var client = new ObservableIssuesLabelsClient(gitHubClient); client.GetAllForIssue("fake", "repo", 42); connection.Received().Get <List <Label> >(Arg.Is <Uri>(u => u.ToString() == "repos/fake/repo/issues/42/labels"), Args.EmptyDictionary, "application/vnd.github.symmetra-preview+json"); }
public void DeleteCorrectUrl() { var connection = Substitute.For <IConnection>(); var gitHubClient = new GitHubClient(connection); var client = new ObservableIssuesLabelsClient(gitHubClient); client.RemoveFromIssue("fake", "repo", 42, "label"); connection.Received().Delete(Arg.Is <Uri>(u => u.ToString() == "repos/fake/repo/issues/42/labels/label")); }
public async Task RequestsCorrectUrlWithRepositoryId() { var connection = Substitute.For <IConnection>(); var gitHubClient = new GitHubClient(connection); var client = new ObservableIssuesLabelsClient(gitHubClient); client.GetAllForIssue(1, 42); connection.Received().Get <List <Label> >(Arg.Is <Uri>(u => u.ToString() == "repositories/1/issues/42/labels"), Args.EmptyDictionary, null); }
public async Task RequestsCorrectUrl() { var connection = Substitute.For <IConnection>(); var gitHubClient = new GitHubClient(connection); var client = new ObservableIssuesLabelsClient(gitHubClient); client.GetAllForMilestone("fake", "repo", 42); connection.Received().Get <List <Label> >(Arg.Is <Uri>(u => u.ToString() == "repos/fake/repo/milestones/42/labels"), Args.EmptyDictionary, null); }
public void DeleteCorrectUrlWithRepositoryId() { var connection = Substitute.For <IConnection>(); var gitHubClient = new GitHubClient(connection); var client = new ObservableIssuesLabelsClient(gitHubClient); client.RemoveFromIssue(1, 42, "label"); connection.Received().Delete <IReadOnlyList <Label> >(Arg.Is <Uri>(u => u.ToString() == "repositories/1/issues/42/labels/label"), Arg.Any <object>(), "application/vnd.github.symmetra-preview+json"); }
public void CreatesCorrectUrlWithRepositoryId() { var gitHubClient = Substitute.For <IGitHubClient>(); var client = new ObservableIssuesLabelsClient(gitHubClient); var newLabel = new NewLabel("labelName", "FF0000"); client.Create(1, newLabel); gitHubClient.Received().Issue.Labels.Create(1, newLabel); }
public void UpdatesCorrectUrlWithRepositoryId() { var gitHubClient = Substitute.For <IGitHubClient>(); var client = new ObservableIssuesLabelsClient(gitHubClient); var labelUpdate = new LabelUpdate("name", "FF0000"); client.Update(1, "labelName", labelUpdate); gitHubClient.Received().Issue.Labels.Update(1, "labelName", labelUpdate); }
public async Task EnsuresNonNullArguments() { var client = new ObservableIssuesLabelsClient(Substitute.For <IGitHubClient>()); var newLabel = new NewLabel("labelName", "FF0000"); Assert.Throws <ArgumentNullException>(() => client.Create(null, "name", newLabel)); Assert.Throws <ArgumentNullException>(() => client.Create("owner", null, newLabel)); Assert.Throws <ArgumentNullException>(() => client.Create("owner", "name", null)); Assert.Throws <ArgumentNullException>(() => client.Create(1, null)); Assert.Throws <ArgumentException>(() => client.Create("", "name", newLabel)); Assert.Throws <ArgumentException>(() => client.Create("owner", "", newLabel)); }
public async Task EnsuresNonNullArguments() { var client = new ObservableIssuesLabelsClient(Substitute.For <IGitHubClient>()); Assert.Throws <ArgumentNullException>(() => client.GetAllForIssue(null, "name", 1)); Assert.Throws <ArgumentNullException>(() => client.GetAllForIssue("owner", null, 1)); Assert.Throws <ArgumentNullException>(() => client.GetAllForIssue(null, "name", 1, ApiOptions.None)); Assert.Throws <ArgumentNullException>(() => client.GetAllForIssue("owner", null, 1, ApiOptions.None)); Assert.Throws <ArgumentNullException>(() => client.GetAllForIssue("owner", "name", 1, null)); Assert.Throws <ArgumentException>(() => client.GetAllForIssue("", "name", 1)); Assert.Throws <ArgumentException>(() => client.GetAllForIssue("owner", "", 1)); Assert.Throws <ArgumentException>(() => client.GetAllForIssue("", "name", 1, ApiOptions.None)); Assert.Throws <ArgumentException>(() => client.GetAllForIssue("owner", "", 1, ApiOptions.None)); }
public async Task RequestsCorrectUrlWithApiOptionsWithRepositoryId() { var connection = Substitute.For <IConnection>(); var gitHubClient = new GitHubClient(connection); var client = new ObservableIssuesLabelsClient(gitHubClient); var options = new ApiOptions { PageCount = 1, StartPage = 1, PageSize = 1 }; client.GetAllForIssue(1, 42, options); connection.Received().Get <List <Label> >(Arg.Is <Uri>(u => u.ToString() == "repositories/1/issues/42/labels"), Arg.Is <Dictionary <string, string> >(d => d.Count == 2), null); }
public async Task RequestsCorrectUrlWithApiOptions() { var connection = Substitute.For <IConnection>(); var gitHubClient = new GitHubClient(connection); var client = new ObservableIssuesLabelsClient(gitHubClient); var options = new ApiOptions { PageCount = 1, StartPage = 1, PageSize = 1 }; client.GetAllForIssue("fake", "repo", 42, options); connection.Received().Get <List <Label> >(Arg.Is <Uri>(u => u.ToString() == "repos/fake/repo/issues/42/labels"), Arg.Is <Dictionary <string, string> >(d => d.Count == 2), "application/vnd.github.symmetra-preview+json"); }
public void EnsuresNonNullArguments() { var client = new ObservableIssuesLabelsClient(Substitute.For <IGitHubClient>()); var labelUpdate = new LabelUpdate("name", "FF0000"); Assert.Throws <ArgumentNullException>(() => client.Update(null, "name", "labelName", labelUpdate)); Assert.Throws <ArgumentNullException>(() => client.Update("owner", null, "labelName", labelUpdate)); Assert.Throws <ArgumentNullException>(() => client.Update("owner", "name", null, labelUpdate)); Assert.Throws <ArgumentNullException>(() => client.Update("owner", "name", "labelName", null)); Assert.Throws <ArgumentNullException>(() => client.Update(1, null, labelUpdate)); Assert.Throws <ArgumentNullException>(() => client.Update(1, "labelName", null)); Assert.Throws <ArgumentException>(() => client.Update("", "name", "labelName", labelUpdate)); Assert.Throws <ArgumentException>(() => client.Update("owner", "", "labelName", labelUpdate)); Assert.Throws <ArgumentException>(() => client.Update("owner", "name", "", labelUpdate)); Assert.Throws <ArgumentException>(() => client.Update(1, "", labelUpdate)); }