public void GetsCorrectUrl()
            {
                var github = Substitute.For<IGitHubClient>();
                var client = new ObservableRepositoriesClient(github);
                var expected = new Uri("repos/owner/repo/branches", UriKind.Relative);

                client.GetAllBranches("owner", "repo");

                github.Connection.Received(1).GetResponse<List<Branch>>(expected);
            }
            public void RequestsTheCorrectUrlWithRepositoryIdWithApiOptions()
            {
                var gitHubClient = Substitute.For<IGitHubClient>();
                var client = new ObservableRepositoriesClient(gitHubClient);
                var expected = new Uri("repositories/1/branches", UriKind.Relative);

                var options = new ApiOptions
                {
                    PageCount = 1,
                    StartPage = 1,
                    PageSize = 1
                };

                client.GetAllBranches(1, options);

                gitHubClient.Connection.Received(1).Get<List<Branch>>(expected, Arg.Is<IDictionary<string, string>>(d => d.Count == 2 && d["page"] == "1" && d["per_page"] == "1"), null);
            }
            public void EnsuresArguments()
            {
                var client = new ObservableRepositoriesClient(Substitute.For<IGitHubClient>());

                Assert.Throws<ArgumentNullException>(() => client.GetAllBranches(null, "repo"));
                Assert.Throws<ArgumentNullException>(() => client.GetAllBranches("owner", null));
                Assert.Throws<ArgumentException>(() => client.GetAllBranches("", "repo"));
                Assert.Throws<ArgumentException>(() => client.GetAllBranches("owner", ""));
            }
            public void RequestsTheCorrectUrlWithRepositoryId()
            {
                var gitHubClient = Substitute.For<IGitHubClient>();
                var client = new ObservableRepositoriesClient(gitHubClient);
                var expected = new Uri("repositories/1/branches", UriKind.Relative);

                client.GetAllBranches(1);

                gitHubClient.Connection.Received(1).Get<List<Branch>>(expected, Args.EmptyDictionary, null);
            }