Ejemplo n.º 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));
            }
Ejemplo n.º 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);
            }
Ejemplo n.º 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);
            }
Ejemplo n.º 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);
            }
Ejemplo n.º 5
0
        public async Task ReturnsPublicGists()
        {
            var gists = await _gistsClient.GetAllPublic().ToList();

            Assert.NotEmpty(gists);
        }