Beispiel #1
0
            public void EnsuresNonNullArguments()
            {
                var client = new ObservableRepositoriesClient(Substitute.For <IGitHubClient>());

                Assert.Throws <ArgumentNullException>(() => client.GetAllLanguages(null, "repo"));
                Assert.Throws <ArgumentNullException>(() => client.GetAllLanguages("owner", null));
                Assert.Throws <ArgumentException>(() => client.GetAllLanguages("", "repo"));
                Assert.Throws <ArgumentException>(() => client.GetAllLanguages("owner", ""));
            }
Beispiel #2
0
            public void GetsCorrectUrl()
            {
                var github   = Substitute.For <IGitHubClient>();
                var client   = new ObservableRepositoriesClient(github);
                var expected = new Uri("repos/owner/repo/languages", UriKind.Relative);

                client.GetAllLanguages("owner", "repo");

                github.Connection.Received(1).GetResponse <List <Tuple <string, long> > >(expected);
            }
            public void RequestsTheCorrectUrlWithRepositoryId()
            {
                var gitHubClient = Substitute.For <IGitHubClient>();
                var client       = new ObservableRepositoriesClient(gitHubClient);
                var expected     = new Uri("repositories/1/languages", UriKind.Relative);

                client.GetAllLanguages(1);

                gitHubClient.Connection.Received(1).GetResponse <List <Tuple <string, long> > >(expected);
            }