public async void TestException() { await Assert.ThrowsAsync <NotImplementedException>(async() => { await FileAccessor.RunAction("file", () => LongRunningTask(() => { throw new NotImplementedException(); }, 10)); }); }
public void TestParallel() { int hit = 0; Task task1 = FileAccessor.RunAction("onefile", () => LongRunningTask(() => { Assert.True(hit == 1); hit++; }, 100)); Task task2 = FileAccessor.RunAction("anotherfile", () => LongRunningTask(() => { Assert.True(hit == 0); hit++; }, 10)); Task.WaitAll(task1, task2); Assert.True(hit == 2); }