From 053248dec6878b341f601c7ec224de15eafcc784 Mon Sep 17 00:00:00 2001 From: Ryan Gribble Date: Mon, 14 Dec 2015 14:20:02 +1000 Subject: [PATCH] Added EditBranch integration test for Octokit.Reactive project --- .../ObservableRepositoriesClientTests.cs | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/Octokit.Tests/Reactive/ObservableRepositoriesClientTests.cs b/Octokit.Tests/Reactive/ObservableRepositoriesClientTests.cs index 78c9ad1e..c0e66b86 100644 --- a/Octokit.Tests/Reactive/ObservableRepositoriesClientTests.cs +++ b/Octokit.Tests/Reactive/ObservableRepositoriesClientTests.cs @@ -463,6 +463,39 @@ namespace Octokit.Tests.Reactive } } + public class TheEditBranchMethod + { + [Fact] + public async Task EnsuresArguments() + { + var github = Substitute.For(); + var nonreactiveClient = new RepositoriesClient(Substitute.For()); + github.Repository.Returns(nonreactiveClient); + var client = new ObservableRepositoriesClient(github); + var update = new BranchUpdate(); + + Assert.Throws(() => client.EditBranch(null, "repo", "branch", update)); + Assert.Throws(() => client.EditBranch("owner", null, "branch", update)); + Assert.Throws(() => client.EditBranch("owner", "repo", null, update)); + Assert.Throws(() => client.EditBranch("owner", "repo", "branch", null)); + Assert.Throws(() => client.EditBranch("", "repo", "branch", update)); + Assert.Throws(() => client.EditBranch("owner", "", "branch", update)); + Assert.Throws(() => client.EditBranch("owner", "repo", "", update)); + } + + [Fact] + public void CallsIntoClient() + { + var github = Substitute.For(); + var client = new ObservableRepositoriesClient(github); + var update = new BranchUpdate(); + + client.EditBranch("owner", "repo", "branch", update); + + github.Repository.Received(1).EditBranch("owner", "repo", "branch", update); + } + } + static IResponse CreateResponseWithApiInfo(IDictionary links) { var response = Substitute.For();