bitly.EndUserAccessToken = "hogehoge";
- var result = await bitly.ShortenAsync(new Uri("http://www.example.com/"), "bit.ly")
- .ConfigureAwait(false);
+ var result = await bitly.ShortenAsync(new Uri("http://www.example.com/"), "bit.ly");
Assert.Equal("http://bit.ly/foo", result.OriginalString);
Assert.Equal(0, mockHandler.QueueCount);
bitly.EndUserLoginName = "username";
bitly.EndUserApiKey = "hogehoge";
- var result = await bitly.ShortenAsync(new Uri("http://www.example.com/"), "bit.ly")
- .ConfigureAwait(false);
+ var result = await bitly.ShortenAsync(new Uri("http://www.example.com/"), "bit.ly");
Assert.Equal("http://bit.ly/foo", result.OriginalString);
Assert.Equal(0, mockHandler.QueueCount);
x.Headers.Authorization.Parameter
);
- var body = await x.Content.ReadAsStringAsync()
- .ConfigureAwait(false);
+ var body = await x.Content.ReadAsStringAsync();
var query = HttpUtility.ParseQueryString(body);
Assert.Equal("password", query["grant_type"]);
};
});
- var result = await bitly.GetAccessTokenAsync("hogehoge", "tetete")
- .ConfigureAwait(false);
+ var result = await bitly.GetAccessTokenAsync("hogehoge", "tetete");
Assert.Equal("abcdefg", result);
Assert.Equal(0, mockHandler.QueueCount);
};
});
- await Assert.ThrowsAsync<WebApiException>(() => bitly.GetAccessTokenAsync("hogehoge", "tetete"))
- .ConfigureAwait(false);
+ await Assert.ThrowsAsync<WebApiException>(() => bitly.GetAccessTokenAsync("hogehoge", "tetete"));
Assert.Equal(0, mockHandler.QueueCount);
}
TweetId = new("12345"),
};
- var tweetId = await request.Send(mock.Object).ConfigureAwait(false);
+ var tweetId = await request.Send(mock.Object);
Assert.Equal("1617128268548964354", tweetId.Id);
mock.VerifyAll();
TweetText = "tetete",
};
- var status = await request.Send(mock.Object).ConfigureAwait(false);
+ var status = await request.Send(mock.Object);
Assert.Equal("1680534146492317696", status.IdStr);
mock.VerifyAll();
InReplyToTweetId = new("12345"),
ExcludeReplyUserIds = new[] { "11111", "22222" },
};
- await request.Send(mock.Object).ConfigureAwait(false);
+ await request.Send(mock.Object);
mock.VerifyAll();
}
TweetText = "tetete",
MediaIds = new[] { "11111", "22222" },
};
- await request.Send(mock.Object).ConfigureAwait(false);
+ await request.Send(mock.Object);
mock.VerifyAll();
}
}
SourceTweetId = new("12345"),
};
- await request.Send(mock.Object).ConfigureAwait(false);
+ await request.Send(mock.Object);
mock.VerifyAll();
}
TweetId = new("12345"),
};
- await request.Send(mock.Object).ConfigureAwait(false);
+ await request.Send(mock.Object);
mock.VerifyAll();
}
Count = 20,
};
- var response = await request.Send(mock.Object).ConfigureAwait(false);
+ var response = await request.Send(mock.Object);
Assert.Single(response.Tweets);
Assert.Equal("DAABCgABF0HfRMjAJxEKAAIWes8rE1oQAAgAAwAAAAEAAA", response.CursorTop);
Assert.Equal("DAABCgABF0HfRMi__7QKAAIVAxUYmFWQAwgAAwAAAAIAAA", response.CursorBottom);
Cursor = "aaa",
};
- await request.Send(mock.Object).ConfigureAwait(false);
+ await request.Send(mock.Object);
mock.VerifyAll();
}
}
Count = 20,
};
- var response = await request.Send(mock.Object).ConfigureAwait(false);
+ var response = await request.Send(mock.Object);
Assert.Single(response.Tweets);
Assert.Equal("DAADDAABCgABFnlh4hraMAYKAAIOTm0DEhTAAQAIAAIAAAABCAADAAAAAAgABAAAAAAKAAUX8j3ezIAnEAoABhfyPd7Mf9jwAAA", response.CursorTop);
Assert.Equal("DAADDAABCgABFnlh4hraMAYKAAIOTm0DEhTAAQAIAAIAAAACCAADAAAAAAgABAAAAAAKAAUX8j3ezIAnEAoABhfyPd7Mf9jwAAA", response.CursorBottom);
Cursor = "aaa",
};
- await request.Send(mock.Object).ConfigureAwait(false);
+ await request.Send(mock.Object);
mock.VerifyAll();
}
}
FocalTweetId = new("1619433164757413894"),
};
- var tweets = await request.Send(mock.Object).ConfigureAwait(false);
+ var tweets = await request.Send(mock.Object);
Assert.Equal("1619433164757413894", tweets.Single().ToTwitterStatus().IdStr);
mock.VerifyAll();
ScreenName = "opentween",
};
- var user = await request.Send(mock.Object).ConfigureAwait(false);
+ var user = await request.Send(mock.Object);
Assert.Equal("514241801", user.ToTwitterUser().IdStr);
mock.VerifyAll();
Count = 20,
};
- var response = await request.Send(mock.Object).ConfigureAwait(false);
+ var response = await request.Send(mock.Object);
Assert.Single(response.Tweets);
Assert.Equal("DAABCgABF_tTnZvAJxEKAAIWes8rE1oQAAgAAwAAAAEAAA", response.CursorTop);
Assert.Equal("DAABCgABF_tTnZu__-0KAAIWZa6KTRoAAwgAAwAAAAIAAA", response.CursorBottom);
Cursor = "aaa",
};
- await request.Send(mock.Object).ConfigureAwait(false);
+ await request.Send(mock.Object);
mock.VerifyAll();
}
}
var imgurApi = new ImgurApi(ApiKey.Create("fake_api_key"), http);
using var mediaItem = TestUtils.CreateDummyMediaItem();
- var uploadedUrl = await imgurApi.UploadFileAsync(mediaItem, "てすと")
- .ConfigureAwait(false);
+ var uploadedUrl = await imgurApi.UploadFileAsync(mediaItem, "てすと");
Assert.Equal("https://i.imgur.com/aaaaaaa.png", uploadedUrl);
Assert.Equal(0, mockHandler.QueueCount);
Assert.Equal("ja", query["to"]);
Assert.Equal("en", query["from"]);
- var requestBody = await x.Content.ReadAsByteArrayAsync()
- .ConfigureAwait(false);
+ var requestBody = await x.Content.ReadAsByteArrayAsync();
using (var jsonReader = JsonReaderWriterFactory.CreateJsonReader(requestBody, XmlDictionaryReaderQuotas.Max))
{
};
});
- var result = await translateApi.TranslateAsync("hogehoge", langTo: "ja", langFrom: "en")
- .ConfigureAwait(false);
+ var result = await translateApi.TranslateAsync("hogehoge", langTo: "ja", langFrom: "en");
Assert.Equal("ほげほげ", result);
mock.Verify(x => x.GetAccessTokenAsync(), Times.Once());
var translateApi = mock.Object;
- await translateApi.UpdateAccessTokenIfExpired()
- .ConfigureAwait(false);
+ await translateApi.UpdateAccessTokenIfExpired();
Assert.Equal("1234abcd", translateApi.AccessToken);
translateApi.AccessToken = "1234abcd";
translateApi.RefreshAccessTokenAt = DateTimeUtc.Now + TimeSpan.FromMinutes(3);
- await translateApi.UpdateAccessTokenIfExpired()
- .ConfigureAwait(false);
+ await translateApi.UpdateAccessTokenIfExpired();
// RefreshAccessTokenAt の時刻を過ぎるまでは GetAccessTokenAsync は呼ばれない
mock.Verify(x => x.GetAccessTokenAsync(), Times.Never());
translateApi.AccessToken = "1234abcd";
translateApi.RefreshAccessTokenAt = DateTimeUtc.Now - TimeSpan.FromMinutes(3);
- await translateApi.UpdateAccessTokenIfExpired()
- .ConfigureAwait(false);
+ await translateApi.UpdateAccessTokenIfExpired();
Assert.Equal("5678efgh", translateApi.AccessToken);
};
});
- var result = await translateApi.GetAccessTokenAsync()
- .ConfigureAwait(false);
+ var result = await translateApi.GetAccessTokenAsync();
var expectedToken = (@"ACCESS_TOKEN", TimeSpan.FromMinutes(10));
Assert.Equal(expectedToken, result);
var mobypictureApi = new MobypictureApi(ApiKey.Create("fake_api_key"), http);
using var mediaItem = TestUtils.CreateDummyMediaItem();
- var uploadedUrl = await mobypictureApi.UploadFileAsync(mediaItem, "てすと")
- .ConfigureAwait(false);
+ var uploadedUrl = await mobypictureApi.UploadFileAsync(mediaItem, "てすと");
Assert.Equal("https://www.mobypicture.com/user/OpenTween/view/00000000", uploadedUrl);
Assert.Equal(0, mockHandler.QueueCount);
using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
twitterApi.ApiConnection = mock.Object;
- await twitterApi.StatusesHomeTimeline(200, maxId: new("900"), sinceId: new("100"))
- .ConfigureAwait(false);
+ await twitterApi.StatusesHomeTimeline(200, maxId: new("900"), sinceId: new("100"));
mock.VerifyAll();
}
using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
twitterApi.ApiConnection = mock.Object;
- await twitterApi.StatusesMentionsTimeline(200, maxId: new("900"), sinceId: new("100"))
- .ConfigureAwait(false);
+ await twitterApi.StatusesMentionsTimeline(200, maxId: new("900"), sinceId: new("100"));
mock.VerifyAll();
}
using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
twitterApi.ApiConnection = mock.Object;
- await twitterApi.StatusesUserTimeline("twitterapi", count: 200, maxId: new("900"), sinceId: new("100"))
- .ConfigureAwait(false);
+ await twitterApi.StatusesUserTimeline("twitterapi", count: 200, maxId: new("900"), sinceId: new("100"));
mock.VerifyAll();
}
using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
twitterApi.ApiConnection = mock.Object;
- await twitterApi.StatusesShow(statusId: new("100"))
- .ConfigureAwait(false);
+ await twitterApi.StatusesShow(statusId: new("100"));
mock.VerifyAll();
}
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" })
- .ConfigureAwait(false);
+ await twitterApi.StatusesLookup(statusIds: new[] { "100", "200" });
mock.VerifyAll();
}
excludeReplyUserIds: new[] { 100L, 200L },
attachmentUrl: "https://twitter.com/twitterapi/status/22634515958"
)
- .IgnoreResponse()
- .ConfigureAwait(false);
+ .IgnoreResponse();
mock.VerifyAll();
}
twitterApi.ApiConnection = mock.Object;
await twitterApi.StatusesUpdate("hogehoge", replyToId: null, mediaIds: null, excludeReplyUserIds: Array.Empty<long>())
- .IgnoreResponse()
- .ConfigureAwait(false);
+ .IgnoreResponse();
mock.VerifyAll();
}
twitterApi.ApiConnection = mock.Object;
await twitterApi.StatusesDestroy(statusId: new("100"))
- .IgnoreResponse()
- .ConfigureAwait(false);
+ .IgnoreResponse();
mock.VerifyAll();
}
twitterApi.ApiConnection = mock.Object;
await twitterApi.StatusesRetweet(new("100"))
- .IgnoreResponse()
- .ConfigureAwait(false);
+ .IgnoreResponse();
mock.VerifyAll();
}
using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
twitterApi.ApiConnection = mock.Object;
- await twitterApi.SearchTweets("from:twitterapi", "en", count: 200, maxId: new("900"), sinceId: new("100"))
- .ConfigureAwait(false);
+ await twitterApi.SearchTweets("from:twitterapi", "en", count: 200, maxId: new("900"), sinceId: new("100"));
mock.VerifyAll();
}
using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
twitterApi.ApiConnection = mock.Object;
- await twitterApi.ListsOwnerships("twitterapi", cursor: -1L, count: 100)
- .ConfigureAwait(false);
+ await twitterApi.ListsOwnerships("twitterapi", cursor: -1L, count: 100);
mock.VerifyAll();
}
using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
twitterApi.ApiConnection = mock.Object;
- await twitterApi.ListsSubscriptions("twitterapi", cursor: -1L, count: 100)
- .ConfigureAwait(false);
+ await twitterApi.ListsSubscriptions("twitterapi", cursor: -1L, count: 100);
mock.VerifyAll();
}
using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
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();
}
twitterApi.ApiConnection = mock.Object;
await twitterApi.ListsCreate("hogehoge", description: "aaaa", @private: true)
- .IgnoreResponse()
- .ConfigureAwait(false);
+ .IgnoreResponse();
mock.VerifyAll();
}
twitterApi.ApiConnection = mock.Object;
await twitterApi.ListsUpdate(12345L, name: "hogehoge", description: "aaaa", @private: true)
- .IgnoreResponse()
- .ConfigureAwait(false);
+ .IgnoreResponse();
mock.VerifyAll();
}
twitterApi.ApiConnection = mock.Object;
await twitterApi.ListsDestroy(12345L)
- .IgnoreResponse()
- .ConfigureAwait(false);
+ .IgnoreResponse();
mock.VerifyAll();
}
using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
twitterApi.ApiConnection = mock.Object;
- await twitterApi.ListsStatuses(12345L, count: 200, maxId: new("900"), sinceId: new("100"), includeRTs: true)
- .ConfigureAwait(false);
+ await twitterApi.ListsStatuses(12345L, count: 200, maxId: new("900"), sinceId: new("100"), includeRTs: true);
mock.VerifyAll();
}
using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
twitterApi.ApiConnection = mock.Object;
- await twitterApi.ListsMembers(12345L, cursor: -1)
- .ConfigureAwait(false);
+ await twitterApi.ListsMembers(12345L, cursor: -1);
mock.VerifyAll();
}
using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
twitterApi.ApiConnection = mock.Object;
- await twitterApi.ListsMembersShow(12345L, "twitterapi")
- .ConfigureAwait(false);
+ await twitterApi.ListsMembersShow(12345L, "twitterapi");
mock.VerifyAll();
}
twitterApi.ApiConnection = mock.Object;
await twitterApi.ListsMembersCreate(12345L, "twitterapi")
- .IgnoreResponse()
- .ConfigureAwait(false);
+ .IgnoreResponse();
mock.VerifyAll();
}
twitterApi.ApiConnection = mock.Object;
await twitterApi.ListsMembersDestroy(12345L, "twitterapi")
- .IgnoreResponse()
- .ConfigureAwait(false);
+ .IgnoreResponse();
mock.VerifyAll();
}
using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
twitterApi.ApiConnection = mock.Object;
- await twitterApi.DirectMessagesEventsList(count: 50, cursor: "12345abcdefg")
- .ConfigureAwait(false);
+ await twitterApi.DirectMessagesEventsList(count: 50, cursor: "12345abcdefg");
mock.VerifyAll();
}
using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
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();
}
using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
twitterApi.ApiConnection = mock.Object;
- await twitterApi.DirectMessagesEventsDestroy(eventId: new("100"))
- .ConfigureAwait(false);
+ await twitterApi.DirectMessagesEventsDestroy(eventId: new("100"));
mock.VerifyAll();
}
using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
twitterApi.ApiConnection = mock.Object;
- await twitterApi.UsersShow(screenName: "twitterapi")
- .ConfigureAwait(false);
+ await twitterApi.UsersShow(screenName: "twitterapi");
mock.VerifyAll();
}
using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
twitterApi.ApiConnection = mock.Object;
- await twitterApi.UsersLookup(userIds: new[] { "11111", "22222" })
- .ConfigureAwait(false);
+ await twitterApi.UsersLookup(userIds: new[] { "11111", "22222" });
mock.VerifyAll();
}
twitterApi.ApiConnection = mock.Object;
await twitterApi.UsersReportSpam(screenName: "twitterapi")
- .IgnoreResponse()
- .ConfigureAwait(false);
+ .IgnoreResponse();
mock.VerifyAll();
}
using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
twitterApi.ApiConnection = mock.Object;
- await twitterApi.FavoritesList(200, maxId: 900L, sinceId: 100L)
- .ConfigureAwait(false);
+ await twitterApi.FavoritesList(200, maxId: 900L, sinceId: 100L);
mock.VerifyAll();
}
twitterApi.ApiConnection = mock.Object;
await twitterApi.FavoritesCreate(statusId: new("100"))
- .IgnoreResponse()
- .ConfigureAwait(false);
+ .IgnoreResponse();
mock.VerifyAll();
}
twitterApi.ApiConnection = mock.Object;
await twitterApi.FavoritesDestroy(statusId: new("100"))
- .IgnoreResponse()
- .ConfigureAwait(false);
+ .IgnoreResponse();
mock.VerifyAll();
}
using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
twitterApi.ApiConnection = mock.Object;
- await twitterApi.FriendshipsShow(sourceScreenName: "twitter", targetScreenName: "twitterapi")
- .ConfigureAwait(false);
+ await twitterApi.FriendshipsShow(sourceScreenName: "twitter", targetScreenName: "twitterapi");
mock.VerifyAll();
}
twitterApi.ApiConnection = mock.Object;
await twitterApi.FriendshipsCreate(screenName: "twitterapi")
- .IgnoreResponse()
- .ConfigureAwait(false);
+ .IgnoreResponse();
mock.VerifyAll();
}
twitterApi.ApiConnection = mock.Object;
await twitterApi.FriendshipsDestroy(screenName: "twitterapi")
- .IgnoreResponse()
- .ConfigureAwait(false);
+ .IgnoreResponse();
mock.VerifyAll();
}
using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
twitterApi.ApiConnection = mock.Object;
- await twitterApi.NoRetweetIds()
- .ConfigureAwait(false);
+ await twitterApi.NoRetweetIds();
mock.VerifyAll();
}
using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
twitterApi.ApiConnection = mock.Object;
- await twitterApi.FollowersIds(cursor: -1L)
- .ConfigureAwait(false);
+ await twitterApi.FollowersIds(cursor: -1L);
mock.VerifyAll();
}
using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
twitterApi.ApiConnection = mock.Object;
- await twitterApi.MutesUsersIds(cursor: -1L)
- .ConfigureAwait(false);
+ await twitterApi.MutesUsersIds(cursor: -1L);
mock.VerifyAll();
}
using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
twitterApi.ApiConnection = mock.Object;
- await twitterApi.BlocksIds(cursor: -1L)
- .ConfigureAwait(false);
+ await twitterApi.BlocksIds(cursor: -1L);
mock.VerifyAll();
}
twitterApi.ApiConnection = mock.Object;
await twitterApi.BlocksCreate(screenName: "twitterapi")
- .IgnoreResponse()
- .ConfigureAwait(false);
+ .IgnoreResponse();
mock.VerifyAll();
}
twitterApi.ApiConnection = mock.Object;
await twitterApi.BlocksDestroy(screenName: "twitterapi")
- .IgnoreResponse()
- .ConfigureAwait(false);
+ .IgnoreResponse();
mock.VerifyAll();
}
using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
twitterApi.ApiConnection = mock.Object;
- await twitterApi.AccountVerifyCredentials()
- .ConfigureAwait(false);
+ await twitterApi.AccountVerifyCredentials();
Assert.Equal(100L, twitterApi.CurrentUserId);
Assert.Equal("opentween", twitterApi.CurrentScreenName);
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();
}
twitterApi.ApiConnection = mock.Object;
await twitterApi.AccountUpdateProfileImage(media)
- .IgnoreResponse()
- .ConfigureAwait(false);
+ .IgnoreResponse();
mock.VerifyAll();
}
using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
twitterApi.ApiConnection = mock.Object;
- await twitterApi.ApplicationRateLimitStatus()
- .ConfigureAwait(false);
+ await twitterApi.ApplicationRateLimitStatus();
mock.VerifyAll();
}
using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
twitterApi.ApiConnection = mock.Object;
- await twitterApi.Configuration()
- .ConfigureAwait(false);
+ await twitterApi.Configuration();
mock.VerifyAll();
}
twitterApi.ApiConnection = mock.Object;
await twitterApi.MediaUploadInit(totalBytes: 123456L, mediaType: "image/png", mediaCategory: "dm_image")
- .IgnoreResponse()
- .ConfigureAwait(false);
+ .IgnoreResponse();
mock.VerifyAll();
}
using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
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();
}
twitterApi.ApiConnection = mock.Object;
await twitterApi.MediaUploadFinalize(mediaId: 11111L)
- .IgnoreResponse()
- .ConfigureAwait(false);
+ .IgnoreResponse();
mock.VerifyAll();
}
using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
twitterApi.ApiConnection = mock.Object;
- await twitterApi.MediaUploadStatus(mediaId: 11111L)
- .ConfigureAwait(false);
+ await twitterApi.MediaUploadStatus(mediaId: 11111L);
mock.VerifyAll();
}
using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret"));
twitterApi.ApiConnection = mock.Object;
- await twitterApi.MediaMetadataCreate(mediaId: 12345L, altText: "hogehoge")
- .ConfigureAwait(false);
+ await twitterApi.MediaMetadataCreate(mediaId: 12345L, altText: "hogehoge");
mock.VerifyAll();
}
UntilId = new("900"),
};
- await request.Send(mock.Object).ConfigureAwait(false);
+ await request.Send(mock.Object);
mock.VerifyAll();
}
// この時点ではまだレスポンスボディは読まれない
Assert.Equal(0, bodyStream.Position);
- var result = await lazyJson.LoadJsonAsync()
- .ConfigureAwait(false);
+ var result = await lazyJson.LoadJsonAsync();
Assert.Equal("hogehoge", result);
}
// この時点ではまだレスポンスボディは読まれない
Assert.Equal(0, bodyStream.Position);
- var exception = await Assert.ThrowsAnyAsync<WebApiException>(() => lazyJson.LoadJsonAsync())
- .ConfigureAwait(false);
+ var exception = await Assert.ThrowsAnyAsync<WebApiException>(
+ () => lazyJson.LoadJsonAsync()
+ );
Assert.IsType<SerializationException>(exception.InnerException);
}
// レスポンスボディを読まずに破棄
await Task.FromResult(lazyJson)
- .IgnoreResponse()
- .ConfigureAwait(false);
+ .IgnoreResponse();
Assert.True(bodyStream.IsDisposed);
}
{
var requestUri = new Uri("http://example.com/api?aaa=1&bbb=2");
- var actual = await OAuthHandler.GetParameters(requestUri, content: null)
- .ConfigureAwait(false);
+ var actual = await OAuthHandler.GetParameters(requestUri, content: null);
var expected = new[]
{
new KeyValuePair<string, string>("aaa", "1"),
};
using var content = new FormUrlEncodedContent(formParams);
- var actual = await OAuthHandler.GetParameters(requestUri, content)
- .ConfigureAwait(false);
+ var actual = await OAuthHandler.GetParameters(requestUri, content);
var expected = new[]
{
content.Add(paramA, "aaa");
content.Add(paramB, "bbb");
- var actual = await OAuthHandler.GetParameters(requestUri, content)
- .ConfigureAwait(false);
+ var actual = await OAuthHandler.GetParameters(requestUri, content);
// multipart/form-data のリクエストではパラメータを署名対象にしない
Assert.Empty(actual);
["bbbb"] = "2222",
};
- var result = await apiConnection.GetAsync<string>(endpoint, param, endpointName: "/hoge/tetete")
- .ConfigureAwait(false);
+ var result = await apiConnection.GetAsync<string>(endpoint, param, endpointName: "/hoge/tetete");
Assert.Equal("hogehoge", result);
Assert.Equal(0, mockHandler.QueueCount);
["bbbb"] = "2222",
};
- await apiConnection.GetAsync<string>(endpoint, param, endpointName: "/hoge/tetete")
- .ConfigureAwait(false);
+ await apiConnection.GetAsync<string>(endpoint, param, endpointName: "/hoge/tetete");
Assert.Equal(0, mockHandler.QueueCount);
}
var endpoint = new Uri("hoge/tetete.json", UriKind.Relative);
- await apiConnection.GetAsync<string>(endpoint, null, endpointName: "/hoge/tetete")
- .ConfigureAwait(false);
+ await apiConnection.GetAsync<string>(endpoint, null, endpointName: "/hoge/tetete");
Assert.Equal(TwitterApiAccessLevel.ReadWriteAndDirectMessage, apiStatus.AccessLevel);
Assert.Equal(new ApiLimit(150, 100, new DateTimeUtc(2013, 1, 1, 0, 0, 0)), apiStatus.AccessLimit["/hoge/tetete"]);
var endpoint = new Uri("hoge/tetete.json", UriKind.Relative);
- var exception = await Assert.ThrowsAsync<TwitterApiException>(() => apiConnection.GetAsync<string>(endpoint, null, endpointName: "/hoge/tetete"))
- .ConfigureAwait(false);
+ var exception = await Assert.ThrowsAsync<TwitterApiException>(
+ () => apiConnection.GetAsync<string>(endpoint, null, endpointName: "/hoge/tetete")
+ );
// エラーレスポンスの読み込みに失敗した場合はステータスコードをそのままメッセージに使用する
Assert.Equal("BadGateway", exception.Message);
var endpoint = new Uri("hoge/tetete.json", UriKind.Relative);
- var exception = await Assert.ThrowsAsync<TwitterApiException>(() => apiConnection.GetAsync<string>(endpoint, null, endpointName: "/hoge/tetete"))
- .ConfigureAwait(false);
+ var exception = await Assert.ThrowsAsync<TwitterApiException>(
+ () => apiConnection.GetAsync<string>(endpoint, null, endpointName: "/hoge/tetete")
+ );
// エラーレスポンスの JSON に含まれるエラーコードに基づいてメッセージを出力する
Assert.Equal("DuplicateStatus", exception.Message);
["bbbb"] = "2222",
};
- var stream = await apiConnection.GetStreamAsync(endpoint, param)
- .ConfigureAwait(false);
+ var stream = await apiConnection.GetStreamAsync(endpoint, param);
using (var memoryStream = new MemoryStream())
{
// 内容の比較のために MemoryStream にコピー
- await stream.CopyToAsync(memoryStream).ConfigureAwait(false);
+ await stream.CopyToAsync(memoryStream);
Assert.Equal(image.Stream.ToArray(), memoryStream.ToArray());
}
Assert.Equal("https://api.twitter.com/1.1/hoge/tetete.json",
x.RequestUri.AbsoluteUri);
- var body = await x.Content.ReadAsStringAsync()
- .ConfigureAwait(false);
+ var body = await x.Content.ReadAsStringAsync();
var query = HttpUtility.ParseQueryString(body);
Assert.Equal("1111", query["aaaa"]);
["bbbb"] = "2222",
};
- var result = await apiConnection.PostLazyAsync<string>(endpoint, param)
- .ConfigureAwait(false);
+ var result = await apiConnection.PostLazyAsync<string>(endpoint, param);
- Assert.Equal("hogehoge", await result.LoadJsonAsync().ConfigureAwait(false));
+ Assert.Equal("hogehoge", await result.LoadJsonAsync());
Assert.Equal(0, mockHandler.QueueCount);
}
.Concat(image.Stream.ToArray())
.Concat(Encoding.UTF8.GetBytes($"\r\n--{boundary}--\r\n"));
- Assert.Equal(expected, await x.Content.ReadAsByteArrayAsync().ConfigureAwait(false));
+ Assert.Equal(expected, await x.Content.ReadAsByteArrayAsync());
return new HttpResponseMessage(HttpStatusCode.OK)
{
["media1"] = media,
};
- var result = await apiConnection.PostLazyAsync<string>(endpoint, param, mediaParam)
- .ConfigureAwait(false);
+ var result = await apiConnection.PostLazyAsync<string>(endpoint, param, mediaParam);
- Assert.Equal("hogehoge", await result.LoadJsonAsync().ConfigureAwait(false));
+ Assert.Equal("hogehoge", await result.LoadJsonAsync());
Assert.Equal(0, mockHandler.QueueCount);
}
var expected = Encoding.UTF8.GetBytes(expectedText);
- Assert.Equal(expected, await x.Content.ReadAsByteArrayAsync().ConfigureAwait(false));
+ Assert.Equal(expected, await x.Content.ReadAsByteArrayAsync());
return new HttpResponseMessage(HttpStatusCode.OK)
{
var endpoint = new Uri("hoge/tetete.json", UriKind.Relative);
- var result = await apiConnection.PostLazyAsync<string>(endpoint, param: null, media: null)
- .ConfigureAwait(false);
+ var result = await apiConnection.PostLazyAsync<string>(endpoint, param: null, media: null);
- Assert.Equal("hogehoge", await result.LoadJsonAsync().ConfigureAwait(false));
+ Assert.Equal("hogehoge", await result.LoadJsonAsync());
Assert.Equal(0, mockHandler.QueueCount);
}
Assert.Equal("application/json; charset=utf-8", x.Content.Headers.ContentType.ToString());
- var body = await x.Content.ReadAsStringAsync()
- .ConfigureAwait(false);
+ var body = await x.Content.ReadAsStringAsync();
Assert.Equal("""{"aaaa": 1111}""", body);
var endpoint = new Uri("hoge/tetete.json", UriKind.Relative);
- var response = await apiConnection.PostJsonAsync(endpoint, """{"aaaa": 1111}""")
- .ConfigureAwait(false);
+ var response = await apiConnection.PostJsonAsync(endpoint, """{"aaaa": 1111}""");
Assert.Equal(@"{""ok"":true}", response);
Assert.Equal(0, mockHandler.QueueCount);
Assert.Equal("application/json; charset=utf-8", x.Content.Headers.ContentType.ToString());
- var body = await x.Content.ReadAsStringAsync()
- .ConfigureAwait(false);
+ var body = await x.Content.ReadAsStringAsync();
Assert.Equal("""{"aaaa": 1111}""", body);
});
var endpoint = new Uri("hoge/tetete.json", UriKind.Relative);
-
- var response = await apiConnection.PostJsonAsync<string>(endpoint, """{"aaaa": 1111}""")
- .ConfigureAwait(false);
-
- var result = await response.LoadJsonAsync()
- .ConfigureAwait(false);
+ var response = await apiConnection.PostJsonAsync<string>(endpoint, """{"aaaa": 1111}""");
+ var result = await response.LoadJsonAsync();
Assert.Equal("hogehoge", result);
var endpoint = new Uri("hoge/tetete.json", UriKind.Relative);
- await apiConnection.DeleteAsync(endpoint)
- .ConfigureAwait(false);
+ await apiConnection.DeleteAsync(endpoint);
Assert.Equal(0, mockHandler.QueueCount);
}
public async Task ImageFormat_GifTest()
{
using var imgStream = File.OpenRead("Resources/re.gif");
- using var image = await MemoryImage.CopyFromStreamAsync(imgStream).ConfigureAwait(false);
+ using var image = await MemoryImage.CopyFromStreamAsync(imgStream);
Assert.Equal(ImageFormat.Gif, image.ImageFormat);
Assert.Equal(".gif", image.ImageFormatExt);
}
{
using var stream = File.OpenRead("Resources/re.gif");
using var memstream = new MemoryStream();
- await stream.CopyToAsync(memstream)
- .ConfigureAwait(false);
+ await stream.CopyToAsync(memstream);
stream.Seek(0, SeekOrigin.Begin);
{
using var stream = File.OpenRead("Resources/re.gif");
using var memstream = new MemoryStream();
- await stream.CopyToAsync(memstream)
- .ConfigureAwait(false);
+ await stream.CopyToAsync(memstream);
stream.Seek(0, SeekOrigin.Begin);
- using var image = await MemoryImage.CopyFromStreamAsync(stream)
- .ConfigureAwait(false);
+ using var image = await MemoryImage.CopyFromStreamAsync(stream);
Assert.Equal(memstream.ToArray(), image.Stream.ToArray());
}
{
using var stream = File.OpenRead("Resources/re.gif");
using var memstream = new MemoryStream();
- await stream.CopyToAsync(memstream)
- .ConfigureAwait(false);
+ await stream.CopyToAsync(memstream);
var imageBytes = memstream.ToArray();
using var image = MemoryImage.CopyFromBytes(imageBytes);
public async Task Equals_Test()
{
using var imgStream1 = File.OpenRead("Resources/re.gif");
- using var image1 = await MemoryImage.CopyFromStreamAsync(imgStream1).ConfigureAwait(false);
+ using var image1 = await MemoryImage.CopyFromStreamAsync(imgStream1);
using var imgStream2 = File.OpenRead("Resources/re.gif");
- using var image2 = await MemoryImage.CopyFromStreamAsync(imgStream2).ConfigureAwait(false);
+ using var image2 = await MemoryImage.CopyFromStreamAsync(imgStream2);
Assert.True(image1.Equals(image2));
Assert.True(image2.Equals(image1));
Assert.False(invoked);
- await shortcut.RunCommand().ConfigureAwait(false);
+ await shortcut.RunCommand();
Assert.True(invoked);
}
var shortcut = ShortcutCommand.Create(Keys.F5)
.Do(async () =>
{
- await Task.Delay(100).ConfigureAwait(false);
+ await Task.Delay(100);
invoked = true;
});
Assert.False(invoked);
- await shortcut.RunCommand().ConfigureAwait(false);
+ await shortcut.RunCommand();
Assert.True(invoked);
}
var service = new FoursquareCheckin(http, ApiKey.Create("%e%INVALID_API_KEY"), ApiKey.Create("%e%INVALID_API_KEY"));
var post = new PostClass();
- var thumb = await service.GetThumbnailInfoAsync("https://www.swarmapp.com/c/xxxxxxxx", post, CancellationToken.None)
- .ConfigureAwait(false);
+ var thumb = await service.GetThumbnailInfoAsync("https://www.swarmapp.com/c/xxxxxxxx", post, CancellationToken.None);
Assert.Null(thumb);
}
var mediaUrl = "https://pbs.twimg.com/media/DYlFv51VwAUdqWr?format=jpg&name=large";
var service = new PbsTwimgCom();
- var thumb = await service.GetThumbnailInfoAsync(mediaUrl, new PostClass(), CancellationToken.None)
- .ConfigureAwait(false);
+ var thumb = await service.GetThumbnailInfoAsync(mediaUrl, new PostClass(), CancellationToken.None);
Assert.NotNull(thumb);
Assert.Equal("https://pbs.twimg.com/media/DYlFv51VwAUdqWr?format=jpg&name=large", thumb!.ThumbnailImageUrl);
var mediaUrl = "https://pbs.twimg.com/media/DYlFv51VwAUdqWr.jpg";
var service = new PbsTwimgCom();
- var thumb = await service.GetThumbnailInfoAsync(mediaUrl, new PostClass(), CancellationToken.None)
- .ConfigureAwait(false);
+ var thumb = await service.GetThumbnailInfoAsync(mediaUrl, new PostClass(), CancellationToken.None);
Assert.NotNull(thumb);
Assert.Equal("https://pbs.twimg.com/media/DYlFv51VwAUdqWr?format=jpg&name=large", thumb!.ThumbnailImageUrl);
{
var service = new Tinami(ApiKey.Create("%e%INVALID_API_KEY"), null);
- var thumbinfo = await service.GetThumbnailInfoAsync("http://www.tinami.com/view/12345", new PostClass(), CancellationToken.None)
- .ConfigureAwait(false);
+ var thumbinfo = await service.GetThumbnailInfoAsync("http://www.tinami.com/view/12345", new PostClass(), CancellationToken.None);
Assert.Null(thumbinfo);
}
var service = new Tumblr(ApiKey.Create("fake_api_key"), http);
var url = "http://hoge.tumblr.com/post/1234567/tetetete";
- await service.GetThumbnailInfoAsync(url, new PostClass(), CancellationToken.None)
- .ConfigureAwait(false);
+ await service.GetThumbnailInfoAsync(url, new PostClass(), CancellationToken.None);
}
Assert.Equal(0, handler.QueueCount);
// Tumblrのカスタムドメイン名を使ってるっぽいURL
var url = "http://tumblr.example.com/post/1234567/tetetete";
- await service.GetThumbnailInfoAsync(url, new PostClass(), CancellationToken.None)
- .ConfigureAwait(false);
+ await service.GetThumbnailInfoAsync(url, new PostClass(), CancellationToken.None);
}
Assert.Equal(0, handler.QueueCount);
var service = new Tumblr(ApiKey.Create("%e%INVALID_API_KEY"), http);
var url = "http://hoge.tumblr.com/post/1234567/tetetete";
- var thumb = await service.GetThumbnailInfoAsync(url, new PostClass(), CancellationToken.None)
- .ConfigureAwait(false);
+ var thumb = await service.GetThumbnailInfoAsync(url, new PostClass(), CancellationToken.None);
Assert.Null(thumb);
}
}
Media = new() { new("http://example.com/abcd") },
};
- await tweetThumbnail.PrepareThumbnails(post, CancellationToken.None)
- .ConfigureAwait(false);
+ await tweetThumbnail.PrepareThumbnails(post, CancellationToken.None);
Assert.True(tweetThumbnail.ThumbnailAvailable);
Assert.Single(tweetThumbnail.Thumbnails);
Media = new() { new("http://hoge.example.com/") },
};
- await tweetThumbnail.PrepareThumbnails(post, CancellationToken.None)
- .ConfigureAwait(false);
+ await tweetThumbnail.PrepareThumbnails(post, CancellationToken.None);
Assert.False(tweetThumbnail.ThumbnailAvailable);
Assert.Throws<InvalidOperationException>(() => tweetThumbnail.Thumbnails);
Media = new() { new("http://example.com/abcd"), new("http://example.com/efgh") },
};
- await tweetThumbnail.PrepareThumbnails(post, CancellationToken.None)
- .ConfigureAwait(false);
+ await tweetThumbnail.PrepareThumbnails(post, CancellationToken.None);
Assert.Equal(2, tweetThumbnail.Thumbnails.Length);
Assert.Equal(0, tweetThumbnail.SelectedIndex);
Media = new() { new("http://example.com/abcd") },
};
- await tweetThumbnail.PrepareThumbnails(post, CancellationToken.None)
- .ConfigureAwait(false);
+ await tweetThumbnail.PrepareThumbnails(post, CancellationToken.None);
Assert.Equal("http://img.example.com/abcd.png", tweetThumbnail.CurrentThumbnail.ThumbnailImageUrl);
Assert.Equal(
Media = new() { new("http://example.com/abcd") },
};
- await tweetThumbnail.PrepareThumbnails(post, CancellationToken.None)
- .ConfigureAwait(false);
+ await tweetThumbnail.PrepareThumbnails(post, CancellationToken.None);
Assert.Equal("http://img.example.com/abcd.png", tweetThumbnail.CurrentThumbnail.ThumbnailImageUrl);
Assert.Equal(
Media = new() { new("http://example.com/abcd"), new("http://example.com/efgh") },
};
- await tweetThumbnail.PrepareThumbnails(post, CancellationToken.None)
- .ConfigureAwait(false);
+ await tweetThumbnail.PrepareThumbnails(post, CancellationToken.None);
Assert.Equal(2, tweetThumbnail.Thumbnails.Length);
Assert.Equal(0, tweetThumbnail.SelectedIndex);