Files

54 lines
1.0 KiB
C#
Raw Permalink Normal View History

using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Xunit;
namespace PocketSharp.Tests
{
public class TestsBase : IDisposable
{
protected PocketClient client;
protected List<string> itemsToDelete = new List<string>();
// setup
public TestsBase()
{
// !! please don't misuse this account !!
client = new PocketClient(
consumerKey: "15396-f6f92101d72c8e270a6c9bb3",
callbackUri: "http://frontendplay.com",
2013-09-27 00:12:02 +02:00
accessCode: "80acf6c5-c198-03c0-b94c-e74402"
);
}
// teardown
public void Dispose()
{
itemsToDelete.ForEach(async id =>
{
await client.Delete(id);
});
}
2013-09-27 01:03:02 +02:00
// async throws
public static async Task ThrowsAsync<TException>(Func<Task> func)
{
var expected = typeof(TException);
Type actual = null;
try
{
await func();
}
catch (Exception e)
{
actual = e.GetType();
}
Assert.Equal(expected, actual);
}
}
}