示例#1
0
            public void EnsuresNonNullArguments()
            {
                var gitsClient = new ObservableGistsClient(Substitute.For <IGitHubClient>());

                Assert.Throws <ArgumentNullException>(() => gitsClient.GetAllPublic(null));
                Assert.Throws <ArgumentNullException>(() => gitsClient.GetAllPublic(DateTimeOffset.Now, null));
            }
示例#2
0
            public void RequestsTheCorrectUrl()
            {
                var gitHubClient = Substitute.For <IGitHubClient>();
                var client       = new ObservableGistsClient(gitHubClient);

                client.GetAllPublic();

                gitHubClient.Connection.Received(1).Get <List <Gist> >(Arg.Is <Uri>(u => u.ToString() == "gists/public"), Args.EmptyDictionary, null);
            }
示例#3
0
            public void RequestsTheCorrectUrlWithSince()
            {
                var gitHubClient = Substitute.For <IGitHubClient>();
                var client       = new ObservableGistsClient(gitHubClient);

                var since = DateTimeOffset.Now;

                client.GetAllPublic(since);

                gitHubClient.Connection.Received(1).Get <List <Gist> >(Arg.Is <Uri>(u => u.ToString() == "gists/public"), DictionaryWithSince, null);
            }
示例#4
0
            public void RequestsTheCorrectUrlWithApiOptions()
            {
                var gitHubClient = Substitute.For <IGitHubClient>();
                var client       = new ObservableGistsClient(gitHubClient);

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

                client.GetAllPublic(options);

                gitHubClient.Connection.Received(1).Get <List <Gist> >(Arg.Is <Uri>(u => u.ToString() == "gists/public"),
                                                                       DictionaryWithApiOptions, null);
            }
        public async Task ReturnsPublicGists()
        {
            var gists = await _gistsClient.GetAllPublic().ToList();

            Assert.NotEmpty(gists);
        }