public async Task EnsuresNonNullArguments()
            {
                var client = new ObservableNotificationsClient(Substitute.For <IGitHubClient>());

                Assert.Throws <ArgumentNullException>(() => client.GetAllForCurrent((ApiOptions)null));
                Assert.Throws <ArgumentNullException>(() => client.GetAllForCurrent((NotificationsRequest)null));
            }
            public void RequestsCorrectUrl()
            {
                var endpoint     = new Uri("notifications", UriKind.Relative);
                var connection   = Substitute.For <IConnection>();
                var gitHubClient = new GitHubClient(connection);
                var client       = new ObservableNotificationsClient(gitHubClient);

                client.GetAllForCurrent();

                connection.Received().Get <List <Notification> >(endpoint, Args.EmptyDictionary, null);
            }
            public void RequestsCorrectUrlNotificationRequest()
            {
                var endpoint     = new Uri("notifications", UriKind.Relative);
                var connection   = Substitute.For <IConnection>();
                var gitHubClient = new GitHubClient(connection);
                var client       = new ObservableNotificationsClient(gitHubClient);

                var notificationsRequest = new NotificationsRequest {
                    All = true
                };

                client.GetAllForCurrent(notificationsRequest);

                connection.Received().Get <List <Notification> >(endpoint, Arg.Is <IDictionary <string, string> >(d => d.Count == 2 &&
                                                                                                                  d["all"] == "true" && d["participating"] == "false"), null);
            }
            public void RequestsCorrectUrlApiOptions()
            {
                var endpoint     = new Uri("notifications", UriKind.Relative);
                var connection   = Substitute.For <IConnection>();
                var gitHubClient = new GitHubClient(connection);
                var client       = new ObservableNotificationsClient(gitHubClient);

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

                client.GetAllForCurrent(options);

                connection.Received().Get <List <Notification> >(endpoint, Arg.Is <Dictionary <string, string> >(d => d.Count == 2), null);
            }