public void RequestsCorrectGetGistsForAUserWithSinceUrl()
        {
            var connection = Substitute.For<IApiConnection>();
            var client = new GistsClient(connection);

            DateTimeOffset since = DateTimeOffset.Now;
            client.GetAllForUser("octokit", since);

            connection.Received().GetAll<Gist>(Arg.Is<Uri>(u => u.ToString() == "users/octokit/gists"),
                Arg.Is<IDictionary<string, string>>(x => x.ContainsKey("since")));
        }
        public void RequestsCorrectGetGistsForAUserUrl()
        {
            var connection = Substitute.For<IApiConnection>();
            var client = new GistsClient(connection);

            client.GetAllForUser("octokit");

            connection.Received().GetAll<Gist>(Arg.Is<Uri>(u => u.ToString() == "users/octokit/gists"));
        }
        public void RequestsCorrectGetGistsForAUserWithSinceUrlAndApiOptions()
        {
            var connection = Substitute.For<IApiConnection>();
            var client = new GistsClient(connection);

            var options = new ApiOptions
            {
                PageSize = 1,
                PageCount = 1,
                StartPage = 1
            };
            DateTimeOffset since = DateTimeOffset.Now;
            client.GetAllForUser("octokit", since, options);

            connection.Received().GetAll<Gist>(Arg.Is<Uri>(u => u.ToString() == "users/octokit/gists"),
                DictionaryWithSince, options);
        }
        public async Task EnsureNonNullArguments()
        {
            var connection = Substitute.For<IApiConnection>();
            var client = new GistsClient(connection);

            await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAllForUser(null));
            await Assert.ThrowsAsync<ArgumentException>(() => client.GetAllForUser(""));
            await Assert.ThrowsAsync<ArgumentException>(() => client.GetAllForUser("", DateTimeOffset.Now));
            await Assert.ThrowsAsync<ArgumentException>(() => client.GetAllForUser("", DateTimeOffset.Now, ApiOptions.None));
            await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAllForUser("user", DateTimeOffset.Now, null));
        }
        public void RequestsCorrectGetGistsForAUserUrlWithApiOptions()
        {
            var connection = Substitute.For<IApiConnection>();
            var client = new GistsClient(connection);

            var options = new ApiOptions
            {
                PageSize = 1,
                PageCount = 1,
                StartPage = 1
            };
            client.GetAllForUser("octokit", options);

            connection.Received().GetAll<Gist>(Arg.Is<Uri>(u => u.ToString() == "users/octokit/gists"), options);

        }