I asked a question in stackoverflow http://stackoverflow.com/q/27220254/1109316 about passing a test after timeout.
Maybe there could be an attribute that makes writing these tests easier?
Instead of:
[Fact]
public void WrongServerKey()
{
bool flag = false;
Task.Run(() =>
{
var result = CallServerWithWrongKey();
flag = true;
});
Task.Delay(TimeSpan.FromSeconds(5)).Wait();
Assert.False(flag);
}
Something like:
[Fact (Timeout = 8000,PassTimeout = true)]
public void WrongServerKey()
{
var result = CallServerWithWrongKey();
}
This test should fail if it reaches the end before the timeout.