OSDN Git Service

IApiConnectionをIApiConnectionLegacyに名前変更
[opentween/open-tween.git] / OpenTween.Tests / Api / TwitterApiTest.cs
index 125b754..d74088b 100644 (file)
@@ -52,13 +52,13 @@ namespace OpenTween.Api
         public void Initialize_Test()
         {
             using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
-            Assert.Null(twitterApi.apiConnection);
+            Assert.Null(twitterApi.ApiConnection);
 
             twitterApi.Initialize("*** AccessToken ***", "*** AccessSecret ***", userId: 100L, screenName: "hogehoge");
 
-            Assert.IsType<TwitterApiConnection>(twitterApi.apiConnection);
+            Assert.IsType<TwitterApiConnection>(twitterApi.ApiConnection);
 
-            var apiConnection = (TwitterApiConnection)twitterApi.apiConnection!;
+            var apiConnection = (TwitterApiConnection)twitterApi.ApiConnection!;
             Assert.Equal("*** AccessToken ***", apiConnection.AccessToken);
             Assert.Equal("*** AccessSecret ***", apiConnection.AccessSecret);
 
@@ -71,9 +71,9 @@ namespace OpenTween.Api
             var oldApiConnection = apiConnection;
             Assert.True(oldApiConnection.IsDisposed);
 
-            Assert.IsType<TwitterApiConnection>(twitterApi.apiConnection);
+            Assert.IsType<TwitterApiConnection>(twitterApi.ApiConnection);
 
-            apiConnection = (TwitterApiConnection)twitterApi.apiConnection!;
+            apiConnection = (TwitterApiConnection)twitterApi.ApiConnection!;
             Assert.Equal("*** AccessToken2 ***", apiConnection.AccessToken);
             Assert.Equal("*** AccessSecret2 ***", apiConnection.AccessSecret);
 
@@ -84,11 +84,12 @@ namespace OpenTween.Api
         [Fact]
         public async Task StatusesHomeTimeline_Test()
         {
-            var mock = new Mock<IApiConnection>();
+            var mock = new Mock<IApiConnectionLegacy>();
             mock.Setup(x =>
                 x.GetAsync<TwitterStatus[]>(
                     new Uri("statuses/home_timeline.json", UriKind.Relative),
-                    new Dictionary<string, string> {
+                    new Dictionary<string, string>
+                    {
                             { "include_entities", "true" },
                             { "include_ext_alt_text", "true" },
                             { "tweet_mode", "extended" },
@@ -101,10 +102,9 @@ namespace OpenTween.Api
             .ReturnsAsync(Array.Empty<TwitterStatus>());
 
             using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
-            twitterApi.apiConnection = mock.Object;
+            twitterApi.ApiConnection = mock.Object;
 
-            await twitterApi.StatusesHomeTimeline(200, maxId: 900L, sinceId: 100L)
-                .ConfigureAwait(false);
+            await twitterApi.StatusesHomeTimeline(200, maxId: new("900"), sinceId: new("100"));
 
             mock.VerifyAll();
         }
@@ -112,11 +112,12 @@ namespace OpenTween.Api
         [Fact]
         public async Task StatusesMentionsTimeline_Test()
         {
-            var mock = new Mock<IApiConnection>();
+            var mock = new Mock<IApiConnectionLegacy>();
             mock.Setup(x =>
                 x.GetAsync<TwitterStatus[]>(
                     new Uri("statuses/mentions_timeline.json", UriKind.Relative),
-                    new Dictionary<string, string> {
+                    new Dictionary<string, string>
+                    {
                             { "include_entities", "true" },
                             { "include_ext_alt_text", "true" },
                             { "tweet_mode", "extended" },
@@ -129,10 +130,9 @@ namespace OpenTween.Api
             .ReturnsAsync(Array.Empty<TwitterStatus>());
 
             using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
-            twitterApi.apiConnection = mock.Object;
+            twitterApi.ApiConnection = mock.Object;
 
-            await twitterApi.StatusesMentionsTimeline(200, maxId: 900L, sinceId: 100L)
-                .ConfigureAwait(false);
+            await twitterApi.StatusesMentionsTimeline(200, maxId: new("900"), sinceId: new("100"));
 
             mock.VerifyAll();
         }
@@ -140,11 +140,12 @@ namespace OpenTween.Api
         [Fact]
         public async Task StatusesUserTimeline_Test()
         {
-            var mock = new Mock<IApiConnection>();
+            var mock = new Mock<IApiConnectionLegacy>();
             mock.Setup(x =>
                 x.GetAsync<TwitterStatus[]>(
                     new Uri("statuses/user_timeline.json", UriKind.Relative),
-                    new Dictionary<string, string> {
+                    new Dictionary<string, string>
+                    {
                             { "screen_name", "twitterapi" },
                             { "include_rts", "true" },
                             { "include_entities", "true" },
@@ -159,10 +160,9 @@ namespace OpenTween.Api
             .ReturnsAsync(Array.Empty<TwitterStatus>());
 
             using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
-            twitterApi.apiConnection = mock.Object;
+            twitterApi.ApiConnection = mock.Object;
 
-            await twitterApi.StatusesUserTimeline("twitterapi", count: 200, maxId: 900L, sinceId: 100L)
-                .ConfigureAwait(false);
+            await twitterApi.StatusesUserTimeline("twitterapi", count: 200, maxId: new("900"), sinceId: new("100"));
 
             mock.VerifyAll();
         }
@@ -170,11 +170,12 @@ namespace OpenTween.Api
         [Fact]
         public async Task StatusesShow_Test()
         {
-            var mock = new Mock<IApiConnection>();
+            var mock = new Mock<IApiConnectionLegacy>();
             mock.Setup(x =>
                 x.GetAsync<TwitterStatus>(
                     new Uri("statuses/show.json", UriKind.Relative),
-                    new Dictionary<string, string> {
+                    new Dictionary<string, string>
+                    {
                             { "id", "100" },
                             { "include_entities", "true" },
                             { "include_ext_alt_text", "true" },
@@ -185,10 +186,36 @@ namespace OpenTween.Api
             .ReturnsAsync(new TwitterStatus { Id = 100L });
 
             using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
-            twitterApi.apiConnection = mock.Object;
+            twitterApi.ApiConnection = mock.Object;
 
-            await twitterApi.StatusesShow(statusId: 100L)
-                .ConfigureAwait(false);
+            await twitterApi.StatusesShow(statusId: new("100"));
+
+            mock.VerifyAll();
+        }
+
+        [Fact]
+        public async Task StatusesLookup_Test()
+        {
+            var mock = new Mock<IApiConnectionLegacy>();
+            mock.Setup(x =>
+                x.GetAsync<TwitterStatus[]>(
+                    new Uri("statuses/lookup.json", UriKind.Relative),
+                    new Dictionary<string, string>
+                    {
+                        { "id", "100,200" },
+                        { "include_entities", "true" },
+                        { "include_ext_alt_text", "true" },
+                        { "tweet_mode", "extended" },
+                    },
+                    "/statuses/lookup"
+                )
+            )
+            .ReturnsAsync(Array.Empty<TwitterStatus>());
+
+            using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
+            twitterApi.ApiConnection = mock.Object;
+
+            await twitterApi.StatusesLookup(statusIds: new[] { "100", "200" });
 
             mock.VerifyAll();
         }
@@ -196,11 +223,12 @@ namespace OpenTween.Api
         [Fact]
         public async Task StatusesUpdate_Test()
         {
-            var mock = new Mock<IApiConnection>();
+            var mock = new Mock<IApiConnectionLegacy>();
             mock.Setup(x =>
                 x.PostLazyAsync<TwitterStatus>(
                     new Uri("statuses/update.json", UriKind.Relative),
-                    new Dictionary<string, string> {
+                    new Dictionary<string, string>
+                    {
                             { "status", "hogehoge" },
                             { "include_entities", "true" },
                             { "include_ext_alt_text", "true" },
@@ -215,18 +243,17 @@ namespace OpenTween.Api
             .ReturnsAsync(LazyJson.Create(new TwitterStatus()));
 
             using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
-            twitterApi.apiConnection = mock.Object;
+            twitterApi.ApiConnection = mock.Object;
 
             await twitterApi.StatusesUpdate(
                     "hogehoge",
-                    replyToId: 100L,
+                    replyToId: new("100"),
                     mediaIds: new[] { 10L, 20L },
                     autoPopulateReplyMetadata: true,
                     excludeReplyUserIds: new[] { 100L, 200L },
                     attachmentUrl: "https://twitter.com/twitterapi/status/22634515958"
                 )
-                .IgnoreResponse()
-                .ConfigureAwait(false);
+                .IgnoreResponse();
 
             mock.VerifyAll();
         }
@@ -234,26 +261,26 @@ namespace OpenTween.Api
         [Fact]
         public async Task StatusesUpdate_ExcludeReplyUserIdsEmptyTest()
         {
-            var mock = new Mock<IApiConnection>();
+            var mock = new Mock<IApiConnectionLegacy>();
             mock.Setup(x =>
                 x.PostLazyAsync<TwitterStatus>(
                     new Uri("statuses/update.json", UriKind.Relative),
-                    new Dictionary<string, string> {
-                            { "status", "hogehoge" },
-                            { "include_entities", "true" },
-                            { "include_ext_alt_text", "true" },
-                            { "tweet_mode", "extended" },
+                    new Dictionary<string, string>
+                    {
+                        { "status", "hogehoge" },
+                        { "include_entities", "true" },
+                        { "include_ext_alt_text", "true" },
+                        { "tweet_mode", "extended" },
                         // exclude_reply_user_ids は空の場合には送信されない
                     })
             )
             .ReturnsAsync(LazyJson.Create(new TwitterStatus()));
 
             using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
-            twitterApi.apiConnection = mock.Object;
+            twitterApi.ApiConnection = mock.Object;
 
             await twitterApi.StatusesUpdate("hogehoge", replyToId: null, mediaIds: null, excludeReplyUserIds: Array.Empty<long>())
-                .IgnoreResponse()
-                .ConfigureAwait(false);
+                .IgnoreResponse();
 
             mock.VerifyAll();
         }
@@ -261,7 +288,7 @@ namespace OpenTween.Api
         [Fact]
         public async Task StatusesDestroy_Test()
         {
-            var mock = new Mock<IApiConnection>();
+            var mock = new Mock<IApiConnectionLegacy>();
             mock.Setup(x =>
                 x.PostLazyAsync<TwitterStatus>(
                     new Uri("statuses/destroy.json", UriKind.Relative),
@@ -270,11 +297,10 @@ namespace OpenTween.Api
             .ReturnsAsync(LazyJson.Create(new TwitterStatus { Id = 100L }));
 
             using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
-            twitterApi.apiConnection = mock.Object;
+            twitterApi.ApiConnection = mock.Object;
 
-            await twitterApi.StatusesDestroy(statusId: 100L)
-                .IgnoreResponse()
-                .ConfigureAwait(false);
+            await twitterApi.StatusesDestroy(statusId: new("100"))
+                .IgnoreResponse();
 
             mock.VerifyAll();
         }
@@ -282,11 +308,12 @@ namespace OpenTween.Api
         [Fact]
         public async Task StatusesRetweet_Test()
         {
-            var mock = new Mock<IApiConnection>();
+            var mock = new Mock<IApiConnectionLegacy>();
             mock.Setup(x =>
                 x.PostLazyAsync<TwitterStatus>(
                     new Uri("statuses/retweet.json", UriKind.Relative),
-                    new Dictionary<string, string> {
+                    new Dictionary<string, string>
+                    {
                             { "id", "100" },
                             { "include_entities", "true" },
                             { "include_ext_alt_text", "true" },
@@ -296,11 +323,10 @@ namespace OpenTween.Api
             .ReturnsAsync(LazyJson.Create(new TwitterStatus()));
 
             using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
-            twitterApi.apiConnection = mock.Object;
+            twitterApi.ApiConnection = mock.Object;
 
-            await twitterApi.StatusesRetweet(100L)
-                .IgnoreResponse()
-                .ConfigureAwait(false);
+            await twitterApi.StatusesRetweet(new("100"))
+                .IgnoreResponse();
 
             mock.VerifyAll();
         }
@@ -308,11 +334,12 @@ namespace OpenTween.Api
         [Fact]
         public async Task SearchTweets_Test()
         {
-            var mock = new Mock<IApiConnection>();
+            var mock = new Mock<IApiConnectionLegacy>();
             mock.Setup(x =>
                 x.GetAsync<TwitterSearchResult>(
                     new Uri("search/tweets.json", UriKind.Relative),
-                    new Dictionary<string, string> {
+                    new Dictionary<string, string>
+                    {
                             { "q", "from:twitterapi" },
                             { "result_type", "recent" },
                             { "include_entities", "true" },
@@ -328,10 +355,9 @@ namespace OpenTween.Api
             .ReturnsAsync(new TwitterSearchResult());
 
             using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
-            twitterApi.apiConnection = mock.Object;
+            twitterApi.ApiConnection = mock.Object;
 
-            await twitterApi.SearchTweets("from:twitterapi", "en", count: 200, maxId: 900L, sinceId: 100L)
-                .ConfigureAwait(false);
+            await twitterApi.SearchTweets("from:twitterapi", "en", count: 200, maxId: new("900"), sinceId: new("100"));
 
             mock.VerifyAll();
         }
@@ -339,11 +365,12 @@ namespace OpenTween.Api
         [Fact]
         public async Task ListsOwnerships_Test()
         {
-            var mock = new Mock<IApiConnection>();
+            var mock = new Mock<IApiConnectionLegacy>();
             mock.Setup(x =>
                 x.GetAsync<TwitterLists>(
                     new Uri("lists/ownerships.json", UriKind.Relative),
-                    new Dictionary<string, string> {
+                    new Dictionary<string, string>
+                    {
                             { "screen_name", "twitterapi" },
                             { "cursor", "-1" },
                             { "count", "100" },
@@ -353,10 +380,9 @@ namespace OpenTween.Api
             .ReturnsAsync(new TwitterLists());
 
             using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
-            twitterApi.apiConnection = mock.Object;
+            twitterApi.ApiConnection = mock.Object;
 
-            await twitterApi.ListsOwnerships("twitterapi", cursor: -1L, count: 100)
-                .ConfigureAwait(false);
+            await twitterApi.ListsOwnerships("twitterapi", cursor: -1L, count: 100);
 
             mock.VerifyAll();
         }
@@ -364,11 +390,12 @@ namespace OpenTween.Api
         [Fact]
         public async Task ListsSubscriptions_Test()
         {
-            var mock = new Mock<IApiConnection>();
+            var mock = new Mock<IApiConnectionLegacy>();
             mock.Setup(x =>
                 x.GetAsync<TwitterLists>(
                     new Uri("lists/subscriptions.json", UriKind.Relative),
-                    new Dictionary<string, string> {
+                    new Dictionary<string, string>
+                    {
                             { "screen_name", "twitterapi" },
                             { "cursor", "-1" },
                             { "count", "100" },
@@ -378,10 +405,9 @@ namespace OpenTween.Api
             .ReturnsAsync(new TwitterLists());
 
             using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
-            twitterApi.apiConnection = mock.Object;
+            twitterApi.ApiConnection = mock.Object;
 
-            await twitterApi.ListsSubscriptions("twitterapi", cursor: -1L, count: 100)
-                .ConfigureAwait(false);
+            await twitterApi.ListsSubscriptions("twitterapi", cursor: -1L, count: 100);
 
             mock.VerifyAll();
         }
@@ -389,11 +415,12 @@ namespace OpenTween.Api
         [Fact]
         public async Task ListsMemberships_Test()
         {
-            var mock = new Mock<IApiConnection>();
+            var mock = new Mock<IApiConnectionLegacy>();
             mock.Setup(x =>
                 x.GetAsync<TwitterLists>(
                     new Uri("lists/memberships.json", UriKind.Relative),
-                    new Dictionary<string, string> {
+                    new Dictionary<string, string>
+                    {
                             { "screen_name", "twitterapi" },
                             { "cursor", "-1" },
                             { "count", "100" },
@@ -404,10 +431,9 @@ namespace OpenTween.Api
             .ReturnsAsync(new TwitterLists());
 
             using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
-            twitterApi.apiConnection = mock.Object;
+            twitterApi.ApiConnection = mock.Object;
 
-            await twitterApi.ListsMemberships("twitterapi", cursor: -1L, count: 100, filterToOwnedLists: true)
-                .ConfigureAwait(false);
+            await twitterApi.ListsMemberships("twitterapi", cursor: -1L, count: 100, filterToOwnedLists: true);
 
             mock.VerifyAll();
         }
@@ -415,11 +441,12 @@ namespace OpenTween.Api
         [Fact]
         public async Task ListsCreate_Test()
         {
-            var mock = new Mock<IApiConnection>();
+            var mock = new Mock<IApiConnectionLegacy>();
             mock.Setup(x =>
                 x.PostLazyAsync<TwitterList>(
                     new Uri("lists/create.json", UriKind.Relative),
-                    new Dictionary<string, string> {
+                    new Dictionary<string, string>
+                    {
                             { "name", "hogehoge" },
                             { "description", "aaaa" },
                             { "mode", "private" },
@@ -428,11 +455,10 @@ namespace OpenTween.Api
             .ReturnsAsync(LazyJson.Create(new TwitterList()));
 
             using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
-            twitterApi.apiConnection = mock.Object;
+            twitterApi.ApiConnection = mock.Object;
 
             await twitterApi.ListsCreate("hogehoge", description: "aaaa", @private: true)
-                .IgnoreResponse()
-                .ConfigureAwait(false);
+                .IgnoreResponse();
 
             mock.VerifyAll();
         }
@@ -440,11 +466,12 @@ namespace OpenTween.Api
         [Fact]
         public async Task ListsUpdate_Test()
         {
-            var mock = new Mock<IApiConnection>();
+            var mock = new Mock<IApiConnectionLegacy>();
             mock.Setup(x =>
                 x.PostLazyAsync<TwitterList>(
                     new Uri("lists/update.json", UriKind.Relative),
-                    new Dictionary<string, string> {
+                    new Dictionary<string, string>
+                    {
                             { "list_id", "12345" },
                             { "name", "hogehoge" },
                             { "description", "aaaa" },
@@ -454,11 +481,10 @@ namespace OpenTween.Api
             .ReturnsAsync(LazyJson.Create(new TwitterList()));
 
             using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
-            twitterApi.apiConnection = mock.Object;
+            twitterApi.ApiConnection = mock.Object;
 
             await twitterApi.ListsUpdate(12345L, name: "hogehoge", description: "aaaa", @private: true)
-                .IgnoreResponse()
-                .ConfigureAwait(false);
+                .IgnoreResponse();
 
             mock.VerifyAll();
         }
@@ -466,22 +492,22 @@ namespace OpenTween.Api
         [Fact]
         public async Task ListsDestroy_Test()
         {
-            var mock = new Mock<IApiConnection>();
+            var mock = new Mock<IApiConnectionLegacy>();
             mock.Setup(x =>
                 x.PostLazyAsync<TwitterList>(
                     new Uri("lists/destroy.json", UriKind.Relative),
-                    new Dictionary<string, string> {
+                    new Dictionary<string, string>
+                    {
                             { "list_id", "12345" },
                     })
             )
             .ReturnsAsync(LazyJson.Create(new TwitterList()));
 
             using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
-            twitterApi.apiConnection = mock.Object;
+            twitterApi.ApiConnection = mock.Object;
 
             await twitterApi.ListsDestroy(12345L)
-                .IgnoreResponse()
-                .ConfigureAwait(false);
+                .IgnoreResponse();
 
             mock.VerifyAll();
         }
@@ -489,11 +515,12 @@ namespace OpenTween.Api
         [Fact]
         public async Task ListsStatuses_Test()
         {
-            var mock = new Mock<IApiConnection>();
+            var mock = new Mock<IApiConnectionLegacy>();
             mock.Setup(x =>
                 x.GetAsync<TwitterStatus[]>(
                     new Uri("lists/statuses.json", UriKind.Relative),
-                    new Dictionary<string, string> {
+                    new Dictionary<string, string>
+                    {
                             { "list_id", "12345" },
                             { "include_entities", "true" },
                             { "include_ext_alt_text", "true" },
@@ -508,10 +535,9 @@ namespace OpenTween.Api
             .ReturnsAsync(Array.Empty<TwitterStatus>());
 
             using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
-            twitterApi.apiConnection = mock.Object;
+            twitterApi.ApiConnection = mock.Object;
 
-            await twitterApi.ListsStatuses(12345L, count: 200, maxId: 900L, sinceId: 100L, includeRTs: true)
-                .ConfigureAwait(false);
+            await twitterApi.ListsStatuses(12345L, count: 200, maxId: new("900"), sinceId: new("100"), includeRTs: true);
 
             mock.VerifyAll();
         }
@@ -519,11 +545,12 @@ namespace OpenTween.Api
         [Fact]
         public async Task ListsMembers_Test()
         {
-            var mock = new Mock<IApiConnection>();
+            var mock = new Mock<IApiConnectionLegacy>();
             mock.Setup(x =>
                 x.GetAsync<TwitterUsers>(
                     new Uri("lists/members.json", UriKind.Relative),
-                    new Dictionary<string, string> {
+                    new Dictionary<string, string>
+                    {
                             { "list_id", "12345" },
                             { "include_entities", "true" },
                             { "include_ext_alt_text", "true" },
@@ -535,10 +562,9 @@ namespace OpenTween.Api
             .ReturnsAsync(new TwitterUsers());
 
             using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
-            twitterApi.apiConnection = mock.Object;
+            twitterApi.ApiConnection = mock.Object;
 
-            await twitterApi.ListsMembers(12345L, cursor: -1)
-                .ConfigureAwait(false);
+            await twitterApi.ListsMembers(12345L, cursor: -1);
 
             mock.VerifyAll();
         }
@@ -546,11 +572,12 @@ namespace OpenTween.Api
         [Fact]
         public async Task ListsMembersShow_Test()
         {
-            var mock = new Mock<IApiConnection>();
+            var mock = new Mock<IApiConnectionLegacy>();
             mock.Setup(x =>
                 x.GetAsync<TwitterUser>(
                     new Uri("lists/members/show.json", UriKind.Relative),
-                    new Dictionary<string, string> {
+                    new Dictionary<string, string>
+                    {
                             { "list_id", "12345" },
                             { "screen_name", "twitterapi" },
                             { "include_entities", "true" },
@@ -562,10 +589,9 @@ namespace OpenTween.Api
             .ReturnsAsync(new TwitterUser());
 
             using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
-            twitterApi.apiConnection = mock.Object;
+            twitterApi.ApiConnection = mock.Object;
 
-            await twitterApi.ListsMembersShow(12345L, "twitterapi")
-                .ConfigureAwait(false);
+            await twitterApi.ListsMembersShow(12345L, "twitterapi");
 
             mock.VerifyAll();
         }
@@ -573,11 +599,12 @@ namespace OpenTween.Api
         [Fact]
         public async Task ListsMembersCreate_Test()
         {
-            var mock = new Mock<IApiConnection>();
+            var mock = new Mock<IApiConnectionLegacy>();
             mock.Setup(x =>
                 x.PostLazyAsync<TwitterUser>(
                     new Uri("lists/members/create.json", UriKind.Relative),
-                    new Dictionary<string, string> {
+                    new Dictionary<string, string>
+                    {
                             { "list_id", "12345" },
                             { "screen_name", "twitterapi" },
                             { "include_entities", "true" },
@@ -588,11 +615,10 @@ namespace OpenTween.Api
             .ReturnsAsync(LazyJson.Create(new TwitterUser()));
 
             using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
-            twitterApi.apiConnection = mock.Object;
+            twitterApi.ApiConnection = mock.Object;
 
             await twitterApi.ListsMembersCreate(12345L, "twitterapi")
-                .IgnoreResponse()
-                .ConfigureAwait(false);
+                .IgnoreResponse();
 
             mock.VerifyAll();
         }
@@ -600,11 +626,12 @@ namespace OpenTween.Api
         [Fact]
         public async Task ListsMembersDestroy_Test()
         {
-            var mock = new Mock<IApiConnection>();
+            var mock = new Mock<IApiConnectionLegacy>();
             mock.Setup(x =>
                 x.PostLazyAsync<TwitterUser>(
                     new Uri("lists/members/destroy.json", UriKind.Relative),
-                    new Dictionary<string, string> {
+                    new Dictionary<string, string>
+                    {
                             { "list_id", "12345" },
                             { "screen_name", "twitterapi" },
                             { "include_entities", "true" },
@@ -615,11 +642,10 @@ namespace OpenTween.Api
             .ReturnsAsync(LazyJson.Create(new TwitterUser()));
 
             using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
-            twitterApi.apiConnection = mock.Object;
+            twitterApi.ApiConnection = mock.Object;
 
             await twitterApi.ListsMembersDestroy(12345L, "twitterapi")
-                .IgnoreResponse()
-                .ConfigureAwait(false);
+                .IgnoreResponse();
 
             mock.VerifyAll();
         }
@@ -627,11 +653,12 @@ namespace OpenTween.Api
         [Fact]
         public async Task DirectMessagesEventsList_Test()
         {
-            var mock = new Mock<IApiConnection>();
+            var mock = new Mock<IApiConnectionLegacy>();
             mock.Setup(x =>
                 x.GetAsync<TwitterMessageEventList>(
                     new Uri("direct_messages/events/list.json", UriKind.Relative),
-                    new Dictionary<string, string> {
+                    new Dictionary<string, string>
+                    {
                             { "count", "50" },
                             { "cursor", "12345abcdefg" },
                     },
@@ -640,10 +667,9 @@ namespace OpenTween.Api
             .ReturnsAsync(new TwitterMessageEventList());
 
             using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
-            twitterApi.apiConnection = mock.Object;
+            twitterApi.ApiConnection = mock.Object;
 
-            await twitterApi.DirectMessagesEventsList(count: 50, cursor: "12345abcdefg")
-                .ConfigureAwait(false);
+            await twitterApi.DirectMessagesEventsList(count: 50, cursor: "12345abcdefg");
 
             mock.VerifyAll();
         }
@@ -651,26 +677,28 @@ namespace OpenTween.Api
         [Fact]
         public async Task DirectMessagesEventsNew_Test()
         {
-            var mock = new Mock<IApiConnection>();
-            var responseText = @"{
-  ""event"": {
-    ""type"": ""message_create"",
-    ""message_create"": {
-      ""target"": {
-        ""recipient_id"": ""12345""
-      },
-      ""message_data"": {
-        ""text"": ""hogehoge"",
-        ""attachment"": {
-          ""type"": ""media"",
-          ""media"": {
-            ""id"": ""67890""
-          }
-        }
-      }
-    }
-  }
-}";
+            var mock = new Mock<IApiConnectionLegacy>();
+            var responseText = """
+                {
+                  "event": {
+                    "type": "message_create",
+                    "message_create": {
+                      "target": {
+                        "recipient_id": "12345"
+                      },
+                      "message_data": {
+                        "text": "hogehoge",
+                        "attachment": {
+                          "type": "media",
+                          "media": {
+                            "id": "67890"
+                          }
+                        }
+                      }
+                    }
+                  }
+                }
+                """;
             mock.Setup(x =>
                 x.PostJsonAsync<TwitterMessageEventSingle>(
                     new Uri("direct_messages/events/new.json", UriKind.Relative),
@@ -679,10 +707,9 @@ namespace OpenTween.Api
             .ReturnsAsync(LazyJson.Create(new TwitterMessageEventSingle()));
 
             using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
-            twitterApi.apiConnection = mock.Object;
+            twitterApi.ApiConnection = mock.Object;
 
-            await twitterApi.DirectMessagesEventsNew(recipientId: 12345L, text: "hogehoge", mediaId: 67890L)
-                .ConfigureAwait(false);
+            await twitterApi.DirectMessagesEventsNew(recipientId: 12345L, text: "hogehoge", mediaId: 67890L);
 
             mock.VerifyAll();
         }
@@ -690,7 +717,7 @@ namespace OpenTween.Api
         [Fact]
         public async Task DirectMessagesEventsDestroy_Test()
         {
-            var mock = new Mock<IApiConnection>();
+            var mock = new Mock<IApiConnectionLegacy>();
             mock.Setup(x =>
                 x.DeleteAsync(
                     new Uri("direct_messages/events/destroy.json?id=100", UriKind.Relative))
@@ -698,10 +725,9 @@ namespace OpenTween.Api
             .Returns(Task.CompletedTask);
 
             using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
-            twitterApi.apiConnection = mock.Object;
+            twitterApi.ApiConnection = mock.Object;
 
-            await twitterApi.DirectMessagesEventsDestroy(eventId: "100")
-                .ConfigureAwait(false);
+            await twitterApi.DirectMessagesEventsDestroy(eventId: new("100"));
 
             mock.VerifyAll();
         }
@@ -709,11 +735,12 @@ namespace OpenTween.Api
         [Fact]
         public async Task UsersShow_Test()
         {
-            var mock = new Mock<IApiConnection>();
+            var mock = new Mock<IApiConnectionLegacy>();
             mock.Setup(x =>
                 x.GetAsync<TwitterUser>(
                     new Uri("users/show.json", UriKind.Relative),
-                    new Dictionary<string, string> {
+                    new Dictionary<string, string>
+                    {
                             { "screen_name", "twitterapi" },
                             { "include_entities", "true" },
                             { "include_ext_alt_text", "true" },
@@ -724,10 +751,9 @@ namespace OpenTween.Api
             .ReturnsAsync(new TwitterUser { ScreenName = "twitterapi" });
 
             using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
-            twitterApi.apiConnection = mock.Object;
+            twitterApi.ApiConnection = mock.Object;
 
-            await twitterApi.UsersShow(screenName: "twitterapi")
-                .ConfigureAwait(false);
+            await twitterApi.UsersShow(screenName: "twitterapi");
 
             mock.VerifyAll();
         }
@@ -735,11 +761,12 @@ namespace OpenTween.Api
         [Fact]
         public async Task UsersLookup_Test()
         {
-            var mock = new Mock<IApiConnection>();
+            var mock = new Mock<IApiConnectionLegacy>();
             mock.Setup(x =>
                 x.GetAsync<TwitterUser[]>(
                     new Uri("users/lookup.json", UriKind.Relative),
-                    new Dictionary<string, string> {
+                    new Dictionary<string, string>
+                    {
                             { "user_id", "11111,22222" },
                             { "include_entities", "true" },
                             { "include_ext_alt_text", "true" },
@@ -750,10 +777,9 @@ namespace OpenTween.Api
             .ReturnsAsync(Array.Empty<TwitterUser>());
 
             using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
-            twitterApi.apiConnection = mock.Object;
+            twitterApi.ApiConnection = mock.Object;
 
-            await twitterApi.UsersLookup(userIds: new[] { "11111", "22222" })
-                .ConfigureAwait(false);
+            await twitterApi.UsersLookup(userIds: new[] { "11111", "22222" });
 
             mock.VerifyAll();
         }
@@ -761,11 +787,12 @@ namespace OpenTween.Api
         [Fact]
         public async Task UsersReportSpam_Test()
         {
-            var mock = new Mock<IApiConnection>();
+            var mock = new Mock<IApiConnectionLegacy>();
             mock.Setup(x =>
                 x.PostLazyAsync<TwitterUser>(
                     new Uri("users/report_spam.json", UriKind.Relative),
-                    new Dictionary<string, string> {
+                    new Dictionary<string, string>
+                    {
                             { "screen_name", "twitterapi" },
                             { "tweet_mode", "extended" },
                     })
@@ -773,11 +800,10 @@ namespace OpenTween.Api
             .ReturnsAsync(LazyJson.Create(new TwitterUser { ScreenName = "twitterapi" }));
 
             using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
-            twitterApi.apiConnection = mock.Object;
+            twitterApi.ApiConnection = mock.Object;
 
             await twitterApi.UsersReportSpam(screenName: "twitterapi")
-                .IgnoreResponse()
-                .ConfigureAwait(false);
+                .IgnoreResponse();
 
             mock.VerifyAll();
         }
@@ -785,11 +811,12 @@ namespace OpenTween.Api
         [Fact]
         public async Task FavoritesList_Test()
         {
-            var mock = new Mock<IApiConnection>();
+            var mock = new Mock<IApiConnectionLegacy>();
             mock.Setup(x =>
                 x.GetAsync<TwitterStatus[]>(
                     new Uri("favorites/list.json", UriKind.Relative),
-                    new Dictionary<string, string> {
+                    new Dictionary<string, string>
+                    {
                             { "include_entities", "true" },
                             { "include_ext_alt_text", "true" },
                             { "tweet_mode", "extended" },
@@ -802,10 +829,9 @@ namespace OpenTween.Api
             .ReturnsAsync(Array.Empty<TwitterStatus>());
 
             using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
-            twitterApi.apiConnection = mock.Object;
+            twitterApi.ApiConnection = mock.Object;
 
-            await twitterApi.FavoritesList(200, maxId: 900L, sinceId: 100L)
-                .ConfigureAwait(false);
+            await twitterApi.FavoritesList(200, maxId: 900L, sinceId: 100L);
 
             mock.VerifyAll();
         }
@@ -813,11 +839,12 @@ namespace OpenTween.Api
         [Fact]
         public async Task FavoritesCreate_Test()
         {
-            var mock = new Mock<IApiConnection>();
+            var mock = new Mock<IApiConnectionLegacy>();
             mock.Setup(x =>
                 x.PostLazyAsync<TwitterStatus>(
                     new Uri("favorites/create.json", UriKind.Relative),
-                    new Dictionary<string, string> {
+                    new Dictionary<string, string>
+                    {
                             { "id", "100" },
                             { "tweet_mode", "extended" },
                     })
@@ -825,11 +852,10 @@ namespace OpenTween.Api
             .ReturnsAsync(LazyJson.Create(new TwitterStatus { Id = 100L }));
 
             using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
-            twitterApi.apiConnection = mock.Object;
+            twitterApi.ApiConnection = mock.Object;
 
-            await twitterApi.FavoritesCreate(statusId: 100L)
-                .IgnoreResponse()
-                .ConfigureAwait(false);
+            await twitterApi.FavoritesCreate(statusId: new("100"))
+                .IgnoreResponse();
 
             mock.VerifyAll();
         }
@@ -837,11 +863,12 @@ namespace OpenTween.Api
         [Fact]
         public async Task FavoritesDestroy_Test()
         {
-            var mock = new Mock<IApiConnection>();
+            var mock = new Mock<IApiConnectionLegacy>();
             mock.Setup(x =>
                 x.PostLazyAsync<TwitterStatus>(
                     new Uri("favorites/destroy.json", UriKind.Relative),
-                    new Dictionary<string, string> {
+                    new Dictionary<string, string>
+                    {
                             { "id", "100" },
                             { "tweet_mode", "extended" },
                     })
@@ -849,11 +876,10 @@ namespace OpenTween.Api
             .ReturnsAsync(LazyJson.Create(new TwitterStatus { Id = 100L }));
 
             using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
-            twitterApi.apiConnection = mock.Object;
+            twitterApi.ApiConnection = mock.Object;
 
-            await twitterApi.FavoritesDestroy(statusId: 100L)
-                .IgnoreResponse()
-                .ConfigureAwait(false);
+            await twitterApi.FavoritesDestroy(statusId: new("100"))
+                .IgnoreResponse();
 
             mock.VerifyAll();
         }
@@ -861,7 +887,7 @@ namespace OpenTween.Api
         [Fact]
         public async Task FriendshipsShow_Test()
         {
-            var mock = new Mock<IApiConnection>();
+            var mock = new Mock<IApiConnectionLegacy>();
             mock.Setup(x =>
                 x.GetAsync<TwitterFriendship>(
                     new Uri("friendships/show.json", UriKind.Relative),
@@ -871,10 +897,9 @@ namespace OpenTween.Api
             .ReturnsAsync(new TwitterFriendship());
 
             using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
-            twitterApi.apiConnection = mock.Object;
+            twitterApi.ApiConnection = mock.Object;
 
-            await twitterApi.FriendshipsShow(sourceScreenName: "twitter", targetScreenName: "twitterapi")
-                .ConfigureAwait(false);
+            await twitterApi.FriendshipsShow(sourceScreenName: "twitter", targetScreenName: "twitterapi");
 
             mock.VerifyAll();
         }
@@ -882,7 +907,7 @@ namespace OpenTween.Api
         [Fact]
         public async Task FriendshipsCreate_Test()
         {
-            var mock = new Mock<IApiConnection>();
+            var mock = new Mock<IApiConnectionLegacy>();
             mock.Setup(x =>
                 x.PostLazyAsync<TwitterFriendship>(
                     new Uri("friendships/create.json", UriKind.Relative),
@@ -891,11 +916,10 @@ namespace OpenTween.Api
             .ReturnsAsync(LazyJson.Create(new TwitterFriendship()));
 
             using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
-            twitterApi.apiConnection = mock.Object;
+            twitterApi.ApiConnection = mock.Object;
 
             await twitterApi.FriendshipsCreate(screenName: "twitterapi")
-                .IgnoreResponse()
-                .ConfigureAwait(false);
+                .IgnoreResponse();
 
             mock.VerifyAll();
         }
@@ -903,7 +927,7 @@ namespace OpenTween.Api
         [Fact]
         public async Task FriendshipsDestroy_Test()
         {
-            var mock = new Mock<IApiConnection>();
+            var mock = new Mock<IApiConnectionLegacy>();
             mock.Setup(x =>
                 x.PostLazyAsync<TwitterFriendship>(
                     new Uri("friendships/destroy.json", UriKind.Relative),
@@ -912,11 +936,10 @@ namespace OpenTween.Api
             .ReturnsAsync(LazyJson.Create(new TwitterFriendship()));
 
             using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
-            twitterApi.apiConnection = mock.Object;
+            twitterApi.ApiConnection = mock.Object;
 
             await twitterApi.FriendshipsDestroy(screenName: "twitterapi")
-                .IgnoreResponse()
-                .ConfigureAwait(false);
+                .IgnoreResponse();
 
             mock.VerifyAll();
         }
@@ -924,7 +947,7 @@ namespace OpenTween.Api
         [Fact]
         public async Task NoRetweetIds_Test()
         {
-            var mock = new Mock<IApiConnection>();
+            var mock = new Mock<IApiConnectionLegacy>();
             mock.Setup(x =>
                 x.GetAsync<long[]>(
                     new Uri("friendships/no_retweets/ids.json", UriKind.Relative),
@@ -934,10 +957,9 @@ namespace OpenTween.Api
             .ReturnsAsync(Array.Empty<long>());
 
             using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
-            twitterApi.apiConnection = mock.Object;
+            twitterApi.ApiConnection = mock.Object;
 
-            await twitterApi.NoRetweetIds()
-                .ConfigureAwait(false);
+            await twitterApi.NoRetweetIds();
 
             mock.VerifyAll();
         }
@@ -945,7 +967,7 @@ namespace OpenTween.Api
         [Fact]
         public async Task FollowersIds_Test()
         {
-            var mock = new Mock<IApiConnection>();
+            var mock = new Mock<IApiConnectionLegacy>();
             mock.Setup(x =>
                 x.GetAsync<TwitterIds>(
                     new Uri("followers/ids.json", UriKind.Relative),
@@ -955,10 +977,9 @@ namespace OpenTween.Api
             .ReturnsAsync(new TwitterIds());
 
             using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
-            twitterApi.apiConnection = mock.Object;
+            twitterApi.ApiConnection = mock.Object;
 
-            await twitterApi.FollowersIds(cursor: -1L)
-                .ConfigureAwait(false);
+            await twitterApi.FollowersIds(cursor: -1L);
 
             mock.VerifyAll();
         }
@@ -966,7 +987,7 @@ namespace OpenTween.Api
         [Fact]
         public async Task MutesUsersIds_Test()
         {
-            var mock = new Mock<IApiConnection>();
+            var mock = new Mock<IApiConnectionLegacy>();
             mock.Setup(x =>
                 x.GetAsync<TwitterIds>(
                     new Uri("mutes/users/ids.json", UriKind.Relative),
@@ -976,10 +997,9 @@ namespace OpenTween.Api
             .ReturnsAsync(new TwitterIds());
 
             using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
-            twitterApi.apiConnection = mock.Object;
+            twitterApi.ApiConnection = mock.Object;
 
-            await twitterApi.MutesUsersIds(cursor: -1L)
-                .ConfigureAwait(false);
+            await twitterApi.MutesUsersIds(cursor: -1L);
 
             mock.VerifyAll();
         }
@@ -987,7 +1007,7 @@ namespace OpenTween.Api
         [Fact]
         public async Task BlocksIds_Test()
         {
-            var mock = new Mock<IApiConnection>();
+            var mock = new Mock<IApiConnectionLegacy>();
             mock.Setup(x =>
                 x.GetAsync<TwitterIds>(
                     new Uri("blocks/ids.json", UriKind.Relative),
@@ -997,10 +1017,9 @@ namespace OpenTween.Api
             .ReturnsAsync(new TwitterIds());
 
             using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
-            twitterApi.apiConnection = mock.Object;
+            twitterApi.ApiConnection = mock.Object;
 
-            await twitterApi.BlocksIds(cursor: -1L)
-                .ConfigureAwait(false);
+            await twitterApi.BlocksIds(cursor: -1L);
 
             mock.VerifyAll();
         }
@@ -1008,11 +1027,12 @@ namespace OpenTween.Api
         [Fact]
         public async Task BlocksCreate_Test()
         {
-            var mock = new Mock<IApiConnection>();
+            var mock = new Mock<IApiConnectionLegacy>();
             mock.Setup(x =>
                 x.PostLazyAsync<TwitterUser>(
                     new Uri("blocks/create.json", UriKind.Relative),
-                    new Dictionary<string, string> {
+                    new Dictionary<string, string>
+                    {
                             { "screen_name", "twitterapi" },
                             { "tweet_mode", "extended" },
                     })
@@ -1020,11 +1040,10 @@ namespace OpenTween.Api
             .ReturnsAsync(LazyJson.Create(new TwitterUser()));
 
             using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
-            twitterApi.apiConnection = mock.Object;
+            twitterApi.ApiConnection = mock.Object;
 
             await twitterApi.BlocksCreate(screenName: "twitterapi")
-                .IgnoreResponse()
-                .ConfigureAwait(false);
+                .IgnoreResponse();
 
             mock.VerifyAll();
         }
@@ -1032,11 +1051,12 @@ namespace OpenTween.Api
         [Fact]
         public async Task BlocksDestroy_Test()
         {
-            var mock = new Mock<IApiConnection>();
+            var mock = new Mock<IApiConnectionLegacy>();
             mock.Setup(x =>
                 x.PostLazyAsync<TwitterUser>(
                     new Uri("blocks/destroy.json", UriKind.Relative),
-                    new Dictionary<string, string> {
+                    new Dictionary<string, string>
+                    {
                             { "screen_name", "twitterapi" },
                             { "tweet_mode", "extended" },
                     })
@@ -1044,11 +1064,10 @@ namespace OpenTween.Api
             .ReturnsAsync(LazyJson.Create(new TwitterUser()));
 
             using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
-            twitterApi.apiConnection = mock.Object;
+            twitterApi.ApiConnection = mock.Object;
 
             await twitterApi.BlocksDestroy(screenName: "twitterapi")
-                .IgnoreResponse()
-                .ConfigureAwait(false);
+                .IgnoreResponse();
 
             mock.VerifyAll();
         }
@@ -1056,11 +1075,12 @@ namespace OpenTween.Api
         [Fact]
         public async Task AccountVerifyCredentials_Test()
         {
-            var mock = new Mock<IApiConnection>();
+            var mock = new Mock<IApiConnectionLegacy>();
             mock.Setup(x =>
                 x.GetAsync<TwitterUser>(
                     new Uri("account/verify_credentials.json", UriKind.Relative),
-                    new Dictionary<string, string> {
+                    new Dictionary<string, string>
+                    {
                             { "include_entities", "true" },
                             { "include_ext_alt_text", "true" },
                             { "tweet_mode", "extended" },
@@ -1074,10 +1094,9 @@ namespace OpenTween.Api
             });
 
             using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
-            twitterApi.apiConnection = mock.Object;
+            twitterApi.ApiConnection = mock.Object;
 
-            await twitterApi.AccountVerifyCredentials()
-                .ConfigureAwait(false);
+            await twitterApi.AccountVerifyCredentials();
 
             Assert.Equal(100L, twitterApi.CurrentUserId);
             Assert.Equal("opentween", twitterApi.CurrentScreenName);
@@ -1088,11 +1107,12 @@ namespace OpenTween.Api
         [Fact]
         public async Task AccountUpdateProfile_Test()
         {
-            var mock = new Mock<IApiConnection>();
+            var mock = new Mock<IApiConnectionLegacy>();
             mock.Setup(x =>
                 x.PostLazyAsync<TwitterUser>(
                     new Uri("account/update_profile.json", UriKind.Relative),
-                    new Dictionary<string, string> {
+                    new Dictionary<string, string>
+                    {
                             { "include_entities", "true" },
                             { "include_ext_alt_text", "true" },
                             { "tweet_mode", "extended" },
@@ -1105,11 +1125,10 @@ namespace OpenTween.Api
             .ReturnsAsync(LazyJson.Create(new TwitterUser()));
 
             using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
-            twitterApi.apiConnection = mock.Object;
+            twitterApi.ApiConnection = mock.Object;
 
             await twitterApi.AccountUpdateProfile(name: "Name", url: "http://example.com/", location: "Location", description: "<script>alert(1)</script>")
-                .IgnoreResponse()
-                .ConfigureAwait(false);
+                .IgnoreResponse();
 
             mock.VerifyAll();
         }
@@ -1119,11 +1138,12 @@ namespace OpenTween.Api
         {
             using var image = TestUtils.CreateDummyImage();
             using var media = new MemoryImageMediaItem(image);
-            var mock = new Mock<IApiConnection>();
+            var mock = new Mock<IApiConnectionLegacy>();
             mock.Setup(x =>
                 x.PostLazyAsync<TwitterUser>(
                     new Uri("account/update_profile_image.json", UriKind.Relative),
-                    new Dictionary<string, string> {
+                    new Dictionary<string, string>
+                    {
                             { "include_entities", "true" },
                             { "include_ext_alt_text", "true" },
                             { "tweet_mode", "extended" },
@@ -1133,11 +1153,10 @@ namespace OpenTween.Api
             .ReturnsAsync(LazyJson.Create(new TwitterUser()));
 
             using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
-            twitterApi.apiConnection = mock.Object;
+            twitterApi.ApiConnection = mock.Object;
 
             await twitterApi.AccountUpdateProfileImage(media)
-                .IgnoreResponse()
-                .ConfigureAwait(false);
+                .IgnoreResponse();
 
             mock.VerifyAll();
         }
@@ -1145,7 +1164,7 @@ namespace OpenTween.Api
         [Fact]
         public async Task ApplicationRateLimitStatus_Test()
         {
-            var mock = new Mock<IApiConnection>();
+            var mock = new Mock<IApiConnectionLegacy>();
             mock.Setup(x =>
                 x.GetAsync<TwitterRateLimits>(
                     new Uri("application/rate_limit_status.json", UriKind.Relative),
@@ -1155,10 +1174,9 @@ namespace OpenTween.Api
             .ReturnsAsync(new TwitterRateLimits());
 
             using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
-            twitterApi.apiConnection = mock.Object;
+            twitterApi.ApiConnection = mock.Object;
 
-            await twitterApi.ApplicationRateLimitStatus()
-                .ConfigureAwait(false);
+            await twitterApi.ApplicationRateLimitStatus();
 
             mock.VerifyAll();
         }
@@ -1166,7 +1184,7 @@ namespace OpenTween.Api
         [Fact]
         public async Task Configuration_Test()
         {
-            var mock = new Mock<IApiConnection>();
+            var mock = new Mock<IApiConnectionLegacy>();
             mock.Setup(x =>
                 x.GetAsync<TwitterConfiguration>(
                     new Uri("help/configuration.json", UriKind.Relative),
@@ -1176,10 +1194,9 @@ namespace OpenTween.Api
             .ReturnsAsync(new TwitterConfiguration());
 
             using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
-            twitterApi.apiConnection = mock.Object;
+            twitterApi.ApiConnection = mock.Object;
 
-            await twitterApi.Configuration()
-                .ConfigureAwait(false);
+            await twitterApi.Configuration();
 
             mock.VerifyAll();
         }
@@ -1187,11 +1204,12 @@ namespace OpenTween.Api
         [Fact]
         public async Task MediaUploadInit_Test()
         {
-            var mock = new Mock<IApiConnection>();
+            var mock = new Mock<IApiConnectionLegacy>();
             mock.Setup(x =>
                 x.PostLazyAsync<TwitterUploadMediaInit>(
                     new Uri("https://upload.twitter.com/1.1/media/upload.json", UriKind.Absolute),
-                    new Dictionary<string, string> {
+                    new Dictionary<string, string>
+                    {
                             { "command", "INIT" },
                             { "total_bytes", "123456" },
                             { "media_type", "image/png" },
@@ -1201,11 +1219,10 @@ namespace OpenTween.Api
             .ReturnsAsync(LazyJson.Create(new TwitterUploadMediaInit()));
 
             using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
-            twitterApi.apiConnection = mock.Object;
+            twitterApi.ApiConnection = mock.Object;
 
             await twitterApi.MediaUploadInit(totalBytes: 123456L, mediaType: "image/png", mediaCategory: "dm_image")
-                .IgnoreResponse()
-                .ConfigureAwait(false);
+                .IgnoreResponse();
 
             mock.VerifyAll();
         }
@@ -1215,11 +1232,12 @@ namespace OpenTween.Api
         {
             using var image = TestUtils.CreateDummyImage();
             using var media = new MemoryImageMediaItem(image);
-            var mock = new Mock<IApiConnection>();
+            var mock = new Mock<IApiConnectionLegacy>();
             mock.Setup(x =>
                 x.PostAsync(
                     new Uri("https://upload.twitter.com/1.1/media/upload.json", UriKind.Absolute),
-                    new Dictionary<string, string> {
+                    new Dictionary<string, string>
+                    {
                             { "command", "APPEND" },
                             { "media_id", "11111" },
                             { "segment_index", "1" },
@@ -1229,10 +1247,9 @@ namespace OpenTween.Api
             .Returns(Task.CompletedTask);
 
             using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
-            twitterApi.apiConnection = mock.Object;
+            twitterApi.ApiConnection = mock.Object;
 
-            await twitterApi.MediaUploadAppend(mediaId: 11111L, segmentIndex: 1, media: media)
-                .ConfigureAwait(false);
+            await twitterApi.MediaUploadAppend(mediaId: 11111L, segmentIndex: 1, media: media);
 
             mock.VerifyAll();
         }
@@ -1240,11 +1257,12 @@ namespace OpenTween.Api
         [Fact]
         public async Task MediaUploadFinalize_Test()
         {
-            var mock = new Mock<IApiConnection>();
+            var mock = new Mock<IApiConnectionLegacy>();
             mock.Setup(x =>
                 x.PostLazyAsync<TwitterUploadMediaResult>(
                     new Uri("https://upload.twitter.com/1.1/media/upload.json", UriKind.Absolute),
-                    new Dictionary<string, string> {
+                    new Dictionary<string, string>
+                    {
                             { "command", "FINALIZE" },
                             { "media_id", "11111" },
                     })
@@ -1252,11 +1270,10 @@ namespace OpenTween.Api
             .ReturnsAsync(LazyJson.Create(new TwitterUploadMediaResult()));
 
             using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
-            twitterApi.apiConnection = mock.Object;
+            twitterApi.ApiConnection = mock.Object;
 
             await twitterApi.MediaUploadFinalize(mediaId: 11111L)
-                .IgnoreResponse()
-                .ConfigureAwait(false);
+                .IgnoreResponse();
 
             mock.VerifyAll();
         }
@@ -1264,11 +1281,12 @@ namespace OpenTween.Api
         [Fact]
         public async Task MediaUploadStatus_Test()
         {
-            var mock = new Mock<IApiConnection>();
+            var mock = new Mock<IApiConnectionLegacy>();
             mock.Setup(x =>
                 x.GetAsync<TwitterUploadMediaResult>(
                     new Uri("https://upload.twitter.com/1.1/media/upload.json", UriKind.Absolute),
-                    new Dictionary<string, string> {
+                    new Dictionary<string, string>
+                    {
                             { "command", "STATUS" },
                             { "media_id", "11111" },
                     },
@@ -1277,10 +1295,9 @@ namespace OpenTween.Api
             .ReturnsAsync(new TwitterUploadMediaResult());
 
             using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
-            twitterApi.apiConnection = mock.Object;
+            twitterApi.ApiConnection = mock.Object;
 
-            await twitterApi.MediaUploadStatus(mediaId: 11111L)
-                .ConfigureAwait(false);
+            await twitterApi.MediaUploadStatus(mediaId: 11111L);
 
             mock.VerifyAll();
         }
@@ -1288,19 +1305,18 @@ namespace OpenTween.Api
         [Fact]
         public async Task MediaMetadataCreate_Test()
         {
-            var mock = new Mock<IApiConnection>();
+            var mock = new Mock<IApiConnectionLegacy>();
             mock.Setup(x =>
                 x.PostJsonAsync(
                     new Uri("https://upload.twitter.com/1.1/media/metadata/create.json", UriKind.Absolute),
-                    "{\"media_id\": \"12345\", \"alt_text\": {\"text\": \"hogehoge\"}}")
+                    """{"media_id": "12345", "alt_text": {"text": "hogehoge"}}""")
             )
-            .Returns(Task.CompletedTask);
+            .ReturnsAsync("");
 
             using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
-            twitterApi.apiConnection = mock.Object;
+            twitterApi.ApiConnection = mock.Object;
 
-            await twitterApi.MediaMetadataCreate(mediaId: 12345L, altText: "hogehoge")
-                .ConfigureAwait(false);
+            await twitterApi.MediaMetadataCreate(mediaId: 12345L, altText: "hogehoge");
 
             mock.VerifyAll();
         }