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);
            }
            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 EnsuresNonNullArguments()
            {
                var client = new ObservableWatchedClient(Substitute.For<IGitHubClient>());

                Assert.Throws<ArgumentNullException>(() => client.GetAllForCurrent(null));
            }
            public void EnsuresNonNullArguments()
            {
                var client = new ObservableWatchedClient(Substitute.For<IGitHubClient>());

                Assert.Throws<ArgumentNullException>(() => client.UnwatchRepo(null, "name"));
                Assert.Throws<ArgumentNullException>(() => client.UnwatchRepo("owner", null));
                Assert.Throws<ArgumentException>(() => client.UnwatchRepo("", "name"));
                Assert.Throws<ArgumentException>(() => client.UnwatchRepo("owner", ""));
            }
            public void CallIntoClient()
            {
                var gitHub = Substitute.For<IGitHubClient>();
                var client = new ObservableWatchedClient(gitHub);

                client.UnwatchRepo("owner", "name");

                gitHub.Activity.Watching.Received().UnwatchRepo("owner", "name");
            }
            public void CallIntoClient()
            {
                var gitHub = Substitute.For<IGitHubClient>();
                var client = new ObservableWatchedClient(gitHub);

                client.WatchRepo("owner", "name", new NewSubscription());

                gitHub.Activity.Watching.Received().WatchRepo("owner", "name", Arg.Any<NewSubscription>());
            }
            public void RequestsCorrectUrlWithRepositoryId()
            {
                var gitHub = Substitute.For<IGitHubClient>();
                var client = new ObservableWatchedClient(gitHub);

                client.UnwatchRepo(1);

                gitHub.Activity.Watching.Received().UnwatchRepo(1);
            }
            public void RequestsCorrectUrlWithRepositoryId()
            {
                var gitHub = Substitute.For<IGitHubClient>();
                var client = new ObservableWatchedClient(gitHub);

                client.WatchRepo(1, new NewSubscription());

                gitHub.Activity.Watching.Received().WatchRepo(1, Arg.Any<NewSubscription>());
            }
            public void RequestsCorrectUrl()
            {
                var gitHub = Substitute.For<IGitHubClient>();
                var client = new ObservableWatchedClient(gitHub);

                client.CheckWatched("owner", "name");

                gitHub.Activity.Watching.Received().CheckWatched("owner", "name");
            }
            public void RequestsCorrectUrlWithRepositoryId()
            {
                var connection = Substitute.For<IConnection>();
                var gitHubClient = Substitute.For<IGitHubClient>();
                gitHubClient.Connection.Returns(connection);
                var client = new ObservableWatchedClient(gitHubClient);

                client.GetAllWatchers(1);

                connection.Received().Get<List<User>>(ApiUrls.Watchers(1), Args.EmptyDictionary, null);
            }