public void AbortedRetryTest()
{
this.iteration = 0;
Aspect retryAspect = new RetryCountAspect(3, 100);
// A thread simulating asynchronous application exit.
Task asyncAbortGenerator = Task.Factory.StartNew(() =>
{
Thread.Sleep(100);
Threading.ApplicationExiting.Set();
});
InstanceProxy<RetryAspectsTest> proxy = this.GetProxy(AspectacularTest.MoreTestAspects(retryAspect));
try
{
proxy.Invoke(test => test.SimulateFailureNTimes(3, true));
}
finally
{
Threading.ApplicationExiting.Reset();
bool aborted = proxy.callLog.Exists(l => l.Key == "Retry Aborted");
Assert.IsTrue(aborted);
asyncAbortGenerator.Wait();
}
}