コード例 #1
0
            public async Task EnsuresArguments()
            {
                var client = new ObservableStarredClient(Substitute.For<IGitHubClient>());

                await AssertEx.Throws<ArgumentException>(async () => await client.CheckStarred(null, "james"));
                await AssertEx.Throws<ArgumentException>(async () => await client.CheckStarred("james", null));
            }
コード例 #2
0
            public async Task EnsuresArguments()
            {
                var client = new ObservableStarredClient(Substitute.For<IGitHubClient>());

                await AssertEx.Throws<ArgumentException>(async () => await client.GetAllStargazers(null, "name"));
                await AssertEx.Throws<ArgumentException>(async () => await client.GetAllStargazers("owner", null));
            }
コード例 #3
0
            public void GetsStarsForUser()
            {
                var connection = Substitute.For<IConnection>();
                var gitHubClient = Substitute.For<IGitHubClient>();
                gitHubClient.Connection.Returns(connection);
                var client = new ObservableStarredClient(gitHubClient);

                client.GetAllForUser("jugglingnutcase");
                connection.Received().GetAsync<List<Repository>>(ApiUrls.StarredByUser("jugglingnutcase"), null, null);
            }
コード例 #4
0
            public void GetsStargazersFromClient()
            {
                var connection = Substitute.For<IConnection>();
                var gitHubClient = Substitute.For<IGitHubClient>();
                gitHubClient.Connection.Returns(connection);
                var client = new ObservableStarredClient(gitHubClient);

                client.GetAllStargazers("jugglingnutcase", "katiejamie");
                connection.Received().GetAsync<List<User>>(ApiUrls.Stargazers("jugglingnutcase", "katiejamie"), null, null);
            }
コード例 #5
0
            public async Task ChecksStarredForUser()
            {
                var gitHubClient = Substitute.For<IGitHubClient>();
                var client = new ObservableStarredClient(gitHubClient);

                client.CheckStarred("jugglingnutcase", "katiejamie");
                gitHubClient.Activity.Starring.Received().CheckStarred("jugglingnutcase", "katiejamie");
            }