public void RequestsCorrectUrlWithTimestampsParametrizedWithApiOptions()
            {
                var endpoint = new Uri("users/banana/starred", UriKind.Relative);
                var connection = Substitute.For<IConnection>();
                var gitHubClient = Substitute.For<IGitHubClient>();
                gitHubClient.Connection.Returns(connection);
                var client = new ObservableStarredClient(gitHubClient);

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

                var starredRequest = new StarredRequest { SortDirection = SortDirection.Ascending };

                client.GetAllForUserWithTimestamps("banana", starredRequest, options);

                connection.Received().Get<List<RepositoryStar>>(endpoint, Arg.Is<IDictionary<string, string>>(d => d.Count == 4 && d["direction"] == "asc" && d["direction"] == "asc" && d["per_page"] == "1" && d["page"] == "1"),
                    "application/vnd.github.v3.star+json");
            }
            public void EnsuresNonNullArguments()
            {
                var client = new ObservableStarredClient(Substitute.For<IGitHubClient>());

                Assert.Throws<ArgumentNullException>(() => client.GetAllForUser(null));
                Assert.Throws<ArgumentNullException>(() => client.GetAllForUser(null, ApiOptions.None));
                Assert.Throws<ArgumentNullException>(() => client.GetAllForUser("banana", (ApiOptions)null));
                Assert.Throws<ArgumentNullException>(() => client.GetAllForUser(null, new StarredRequest()));
                Assert.Throws<ArgumentNullException>(() => client.GetAllForUser("banana", (StarredRequest)null));
                Assert.Throws<ArgumentNullException>(() => client.GetAllForUser(null, new StarredRequest(), ApiOptions.None));
                Assert.Throws<ArgumentNullException>(() => client.GetAllForUser("banana", null, ApiOptions.None));
                Assert.Throws<ArgumentNullException>(() => client.GetAllForUser("banana", new StarredRequest(), null));

                Assert.Throws<ArgumentNullException>(() => client.GetAllForUserWithTimestamps(null));
                Assert.Throws<ArgumentNullException>(() => client.GetAllForUserWithTimestamps(null, ApiOptions.None));
                Assert.Throws<ArgumentNullException>(() => client.GetAllForUserWithTimestamps("banana", (ApiOptions)null));
                Assert.Throws<ArgumentNullException>(() => client.GetAllForUserWithTimestamps(null, new StarredRequest()));
                Assert.Throws<ArgumentNullException>(() => client.GetAllForUserWithTimestamps("banana", (StarredRequest)null));
                Assert.Throws<ArgumentNullException>(() => client.GetAllForUserWithTimestamps(null, new StarredRequest(), ApiOptions.None));
                Assert.Throws<ArgumentNullException>(() => client.GetAllForUserWithTimestamps("banana", null, ApiOptions.None));
                Assert.Throws<ArgumentNullException>(() => client.GetAllForUserWithTimestamps("banana", new StarredRequest(), null));

                Assert.Throws<ArgumentException>(() => client.GetAllForUser(""));
                Assert.Throws<ArgumentException>(() => client.GetAllForUser("", ApiOptions.None));
                Assert.Throws<ArgumentException>(() => client.GetAllForUser("", new StarredRequest(), ApiOptions.None));
                Assert.Throws<ArgumentException>(() => client.GetAllForUserWithTimestamps(""));
                Assert.Throws<ArgumentException>(() => client.GetAllForUserWithTimestamps("", ApiOptions.None));
                Assert.Throws<ArgumentException>(() => client.GetAllForUserWithTimestamps("", new StarredRequest(), ApiOptions.None));
            }
            public void RequestsCorrectUrlWithTimestamps()
            {
                var endpoint = new Uri("users/banana/starred", UriKind.Relative);
                var connection = Substitute.For<IConnection>();
                var gitHubClient = Substitute.For<IGitHubClient>();
                gitHubClient.Connection.Returns(connection);
                var client = new ObservableStarredClient(gitHubClient);

                client.GetAllForUserWithTimestamps("banana");

                connection.Received().Get<List<RepositoryStar>>(endpoint, Args.EmptyDictionary,
                    "application/vnd.github.v3.star+json");
            }