FriendshipsShow() public method

public FriendshipsShow ( string sourceScreenName, string targetScreenName ) : Task
sourceScreenName string
targetScreenName string
return Task
示例#1
0
        public async Task FriendshipsShow_Test()
        {
            var mock = new Mock <IApiConnection>();

            mock.Setup(x =>
                       x.GetAsync <TwitterFriendship>(
                           new Uri("friendships/show.json", UriKind.Relative),
                           new Dictionary <string, string> {
                { "source_screen_name", "twitter" }, { "target_screen_name", "twitterapi" }
            },
                           "/friendships/show")
                       )
            .ReturnsAsync(new TwitterFriendship());

            using var twitterApi     = new TwitterApi();
            twitterApi.apiConnection = mock.Object;

            await twitterApi.FriendshipsShow(sourceScreenName : "twitter", targetScreenName : "twitterapi")
            .ConfigureAwait(false);

            mock.VerifyAll();
        }
示例#2
0
        public async Task FriendshipsShow_Test()
        {
            using (var twitterApi = new TwitterApi())
            {
                var mock = new Mock<IApiConnection>();
                mock.Setup(x =>
                    x.GetAsync<TwitterFriendship>(
                        new Uri("friendships/show.json", UriKind.Relative),
                        new Dictionary<string, string> { { "source_screen_name", "twitter" }, { "target_screen_name", "twitterapi" } },
                        "/friendships/show")
                )
                .ReturnsAsync(new TwitterFriendship());

                twitterApi.apiConnection = mock.Object;

                await twitterApi.FriendshipsShow(sourceScreenName: "twitter", targetScreenName: "twitterapi")
                    .ConfigureAwait(false);

                mock.VerifyAll();
            }
        }