public void EnsuresNonNullArguments()
            {
                var client = new ObservableRepositoryBranchesClient(Substitute.For <IGitHubClient>());

                Assert.Throws <ArgumentNullException>(() => client.GetAll(null, "name"));
                Assert.Throws <ArgumentNullException>(() => client.GetAll("owner", null));

                Assert.Throws <ArgumentNullException>(() => client.GetAll(null, "name", ApiOptions.None));
                Assert.Throws <ArgumentNullException>(() => client.GetAll("owner", null, ApiOptions.None));
                Assert.Throws <ArgumentNullException>(() => client.GetAll("owner", "name", null));

                Assert.Throws <ArgumentNullException>(() => client.GetAll(1, null));

                Assert.Throws <ArgumentException>(() => client.GetAll("", "name"));
                Assert.Throws <ArgumentException>(() => client.GetAll("owner", ""));
                Assert.Throws <ArgumentException>(() => client.GetAll("", "name", ApiOptions.None));
                Assert.Throws <ArgumentException>(() => client.GetAll("owner", "", ApiOptions.None));
            }
            public void RequestsTheCorrectUrlWithRepositoryId()
            {
                var gitHubClient = Substitute.For <IGitHubClient>();
                var client       = new ObservableRepositoryBranchesClient(gitHubClient);
                var expected     = new Uri("repositories/1/branches", UriKind.Relative);

                client.GetAll(1);

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

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

                client.GetAll(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);
            }