Пример #1
0
            public void EnsuresNonNullArguments()
            {
                var gitHubClient = Substitute.For <IGitHubClient>();
                var client       = new ObservableEventsClient(gitHubClient);

                Assert.Throws <ArgumentNullException>(() => client.GetAll(null));
            }
Пример #2
0
            public void RequestsCorrectUrl()
            {
                var gitHubClient = Substitute.For <IGitHubClient>();
                var client       = new ObservableEventsClient(gitHubClient);

                client.GetAll();

                gitHubClient.Connection.Received(1).Get <List <Activity> >(new Uri("events", UriKind.Relative), Args.EmptyDictionary, null);
            }
            public void RequestsCorrectUrl()
            {
                var gitHubClient = Substitute.For <IGitHubClient>();
                var client       = new ObservableEventsClient(gitHubClient);

                client.GetAll();

                gitHubClient.Connection.GetAsync <IReadOnlyList <Activity> >(new Uri("events", UriKind.Relative), null, null);
            }
Пример #4
0
            public void RequestsCorrectUrlWithApiOptions()
            {
                var gitHubClient = Substitute.For <IGitHubClient>();
                var client       = new ObservableEventsClient(gitHubClient);

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

                client.GetAll(options);

                gitHubClient.Connection.Received().Get <List <Activity> >(new Uri("events", UriKind.Relative), Arg.Is <IDictionary <string, string> >(d => d.Count == 2), null);
            }
Пример #5
0
            public async Task ReturnsEvents()
            {
                var events = await _eventsClient.GetAll().ToList();

                Assert.NotEmpty(events);
            }