public async Task EnsuresNonNullArguments()
            {
                var client = new ObservableIssuesLabelsClient(Substitute.For <IGitHubClient>());

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

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

                Assert.Throws <ArgumentException>(() => client.GetAllForRepository("", "name"));
                Assert.Throws <ArgumentException>(() => client.GetAllForRepository("owner", ""));
                Assert.Throws <ArgumentException>(() => client.GetAllForRepository("", "name", ApiOptions.None));
                Assert.Throws <ArgumentException>(() => client.GetAllForRepository("owner", "", ApiOptions.None));
            }
            public async Task RequestsCorrectUrlWithRepositoryId()
            {
                var connection   = Substitute.For <IConnection>();
                var gitHubClient = new GitHubClient(connection);
                var client       = new ObservableIssuesLabelsClient(gitHubClient);

                client.GetAllForRepository(1);

                connection.Received().Get <List <Label> >(Arg.Is <Uri>(u => u.ToString() == "repositories/1/labels"), Args.EmptyDictionary, null);
            }
            public async Task RequestsCorrectUrl()
            {
                var connection   = Substitute.For <IConnection>();
                var gitHubClient = new GitHubClient(connection);
                var client       = new ObservableIssuesLabelsClient(gitHubClient);

                client.GetAllForRepository("fake", "repo");

                connection.Received().Get <List <Label> >(Arg.Is <Uri>(u => u.ToString() == "repos/fake/repo/labels"), Args.EmptyDictionary, "application/vnd.github.symmetra-preview+json");
            }
            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.GetAllForRepository(1, options);

                connection.Received().Get <List <Label> >(Arg.Is <Uri>(u => u.ToString() == "repositories/1/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.GetAllForRepository("fake", "repo", options);

                connection.Received().Get <List <Label> >(Arg.Is <Uri>(u => u.ToString() == "repos/fake/repo/labels"), Arg.Is <Dictionary <string, string> >(d => d.Count == 2), "application/vnd.github.symmetra-preview+json");
            }