using Xunit;
using Xunit.Extensions;
-#pragma warning disable 1998 // awaitが無いasyncラムダ式に対する警告を抑制
-
namespace OpenTween
{
public class ShortUrlTest
var shortUrl = new ShortUrl(new HttpClient(handler));
// http://t.co/hoge1 -> http://example.com/hoge2
- handler.Queue.Enqueue(async x =>
+ handler.Enqueue(x =>
{
Assert.Equal(HttpMethod.Head, x.Method);
Assert.Equal(new Uri("http://t.co/hoge1"), x.RequestUri);
shortUrl.DisableExpanding = true;
// http://t.co/hoge1 -> http://example.com/hoge2
- handler.Queue.Enqueue(async x =>
+ handler.Enqueue(x =>
{
// このリクエストは実行されないはず
Assert.True(false);
var shortUrl = new ShortUrl(new HttpClient(handler));
// http://t.co/hoge1 -> http://bit.ly/hoge2
- handler.Queue.Enqueue(async x =>
+ handler.Enqueue(x =>
{
Assert.Equal(HttpMethod.Head, x.Method);
Assert.Equal(new Uri("http://t.co/hoge1"), x.RequestUri);
});
// http://bit.ly/hoge2 -> http://example.com/hoge3
- handler.Queue.Enqueue(async x =>
+ handler.Enqueue(x =>
{
Assert.Equal(HttpMethod.Head, x.Method);
Assert.Equal(new Uri("http://bit.ly/hoge2"), x.RequestUri);
var shortUrl = new ShortUrl(new HttpClient(handler));
// http://t.co/hoge1 -> http://bit.ly/hoge2
- handler.Queue.Enqueue(async x =>
+ handler.Enqueue(x =>
{
Assert.Equal(HttpMethod.Head, x.Method);
Assert.Equal(new Uri("http://t.co/hoge1"), x.RequestUri);
});
// http://bit.ly/hoge2 -> http://tinyurl.com/hoge3
- handler.Queue.Enqueue(async x =>
+ handler.Enqueue(x =>
{
Assert.Equal(HttpMethod.Head, x.Method);
Assert.Equal(new Uri("http://bit.ly/hoge2"), x.RequestUri);
});
// http://tinyurl.com/hoge3 -> http://example.com/hoge4
- handler.Queue.Enqueue(async x =>
+ handler.Enqueue(x =>
{
// このリクエストは実行されないはず
Assert.True(false);
var shortUrl = new ShortUrl(new HttpClient(handler));
// http://t.co/hoge1 -> http://example.com/hoge2
- handler.Queue.Enqueue(async x =>
+ handler.Enqueue(x =>
{
Assert.Equal(HttpMethod.Head, x.Method);
Assert.Equal(new Uri("http://t.co/hoge1"), x.RequestUri);
var shortUrl = new ShortUrl(new HttpClient(handler));
// http://t.co/hoge1 -> http://example.com/hoge2
- handler.Queue.Enqueue(async x =>
+ handler.Enqueue(x =>
{
Assert.Equal(HttpMethod.Head, x.Method);
Assert.Equal(new Uri("http://t.co/hoge1"), x.RequestUri);
var handler = new HttpMessageHandlerMock();
var shortUrl = new ShortUrl(new HttpClient(handler));
- handler.Queue.Enqueue(async x =>
+ handler.Enqueue(x =>
{
// リクエストは送信されないはず
Assert.True(false);
var shortUrl = new ShortUrl(new HttpClient(handler));
// http://t.co/hoge1 -> 503 Service Unavailable
- handler.Queue.Enqueue(async x =>
+ handler.Enqueue(x =>
{
return new HttpResponseMessage(HttpStatusCode.ServiceUnavailable);
});
var shortUrl = new ShortUrl(new HttpClient(handler));
// http://t.co/hoge1 -> http://example.com/hoge2
- handler.Queue.Enqueue(async x =>
+ handler.Enqueue(x =>
{
Assert.Equal(HttpMethod.Head, x.Method);
Assert.Equal(new Uri("http://t.co/hoge1"), x.RequestUri);
var handler = new HttpMessageHandlerMock();
var shortUrl = new ShortUrl(new HttpClient(handler));
- handler.Queue.Enqueue(async x =>
+ handler.Enqueue(async x =>
{
Assert.Equal(HttpMethod.Post, x.Method);
Assert.Equal(new Uri("http://tinyurl.com/api-create.php"), x.RequestUri);
var handler = new HttpMessageHandlerMock();
var shortUrl = new ShortUrl(new HttpClient(handler));
- handler.Queue.Enqueue(async x =>
+ handler.Enqueue(x =>
{
Assert.Equal(HttpMethod.Get, x.Method);
Assert.Equal("http://ux.nu/api/short?format=plain&url=http://example.com/hogehoge",
using Xunit;
using Xunit.Extensions;
-#pragma warning disable 1998 // awaitが無いasyncラムダ式に対する警告を抑制
-
namespace OpenTween.Thumbnail.Services
{
public class FoursquareCheckinTest
var handler = new HttpMessageHandlerMock();
var service = new FoursquareCheckin(new HttpClient(handler));
- handler.Queue.Enqueue(async x =>
+ handler.Enqueue(x =>
{
Assert.Equal(HttpMethod.Get, x.Method);
Assert.Equal("https://api.foursquare.com/v2/checkins/xxxxxxxx",
var handler = new HttpMessageHandlerMock();
var service = new FoursquareCheckin(new HttpClient(handler));
- handler.Queue.Enqueue(async x =>
+ handler.Enqueue(x =>
{
Assert.Equal(HttpMethod.Get, x.Method);
Assert.Equal("https://api.foursquare.com/v2/checkins/xxxxxxxx",
var handler = new HttpMessageHandlerMock();
var service = new FoursquareCheckin(new HttpClient(handler));
- handler.Queue.Enqueue(async x =>
+ handler.Enqueue(x =>
{
// このリクエストは実行されないはず
Assert.True(false);