The test is as follows:
[TestMethod()]
public void IncrementTestNegative() {
CancellationTokenSource s = new CancellationTokenSource();
s.CancelAfter(10);
ManualResetEventSlim evt = new ManualResetEventSlim();
bool breached = false;
Task.Run(() => {
Thread.Sleep(200);
breached = true;
}, s.Token).ContinueWith((t) => {
evt.Set();
});
evt.Wait();
Assert.IsFalse(breached);
}
If I provide a value of "0" to CancelAfter, then the test case succeeds. Why does this test keep failing with other values.
This is using MS Test framework within Visual Studio Express
Aucun commentaire:
Enregistrer un commentaire