public void EnsuresNonNullArguments()
            {
                var client = new ObservableWatchedClient(Substitute.For <IGitHubClient>());

                Assert.Throws <ArgumentNullException>(() => client.GetAllForUser(null));
                Assert.Throws <ArgumentNullException>(() => client.GetAllForUser(null, ApiOptions.None));
                Assert.Throws <ArgumentNullException>(() => client.GetAllForUser("user", null));

                Assert.Throws <ArgumentException>(() => client.GetAllForUser(""));
                Assert.Throws <ArgumentException>(() => client.GetAllForUser("", ApiOptions.None));
            }
            public void RequestsCorrectUrl()
            {
                var connection   = Substitute.For <IConnection>();
                var gitHubClient = Substitute.For <IGitHubClient>();

                gitHubClient.Connection.Returns(connection);
                var client = new ObservableWatchedClient(gitHubClient);

                client.GetAllForUser("jugglingnutcase");
                connection.Received().Get <List <Repository> >(ApiUrls.WatchedByUser("jugglingnutcase"), Args.EmptyDictionary, null);
            }
            public void RequestsCorrectUrlWithApiOptions()
            {
                var connection   = Substitute.For <IConnection>();
                var gitHubClient = Substitute.For <IGitHubClient>();

                gitHubClient.Connection.Returns(connection);
                var client = new ObservableWatchedClient(gitHubClient);

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

                client.GetAllForUser("jugglingnutcase", options);
                connection.Received().Get <List <Repository> >(ApiUrls.WatchedByUser("jugglingnutcase"), Arg.Is <IDictionary <string, string> >(d => d.Count == 2), null);
            }