BlocksCreate() public méthode

public BlocksCreate ( string screenName ) : Task>
screenName string
Résultat Task>
        public async Task BlocksCreate_Test()
        {
            var mock = new Mock <IApiConnection>();

            mock.Setup(x =>
                       x.PostLazyAsync <TwitterUser>(
                           new Uri("blocks/create.json", UriKind.Relative),
                           new Dictionary <string, string> {
                { "screen_name", "twitterapi" },
                { "tweet_mode", "extended" },
            })
                       )
            .ReturnsAsync(LazyJson.Create(new TwitterUser()));

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

            await twitterApi.BlocksCreate(screenName : "twitterapi")
            .IgnoreResponse()
            .ConfigureAwait(false);

            mock.VerifyAll();
        }
Exemple #2
0
        public async Task BlocksCreate_Test()
        {
            using (var twitterApi = new TwitterApi())
            {
                var mock = new Mock<IApiConnection>();
                mock.Setup(x =>
                    x.PostLazyAsync<TwitterUser>(
                        new Uri("blocks/create.json", UriKind.Relative),
                        new Dictionary<string, string> {
                            { "screen_name", "twitterapi" },
                            { "tweet_mode", "extended" },
                        })
                )
                .ReturnsAsync(LazyJson.Create(new TwitterUser()));

                twitterApi.apiConnection = mock.Object;

                await twitterApi.BlocksCreate(screenName: "twitterapi")
                    .IgnoreResponse()
                    .ConfigureAwait(false);

                mock.VerifyAll();
            }
        }