public async Task TestAdapter_TestFlow(Type exceptionType) { Exception innerException = (Exception)Activator.CreateInstance(exceptionType); var promise = new TaskCompletionSource <bool>(); promise.SetException(innerException); var adapter = this.CreateAdapter(); TestFlow testFlow = new TestFlow(promise.Task, adapter); testFlow.Send(new Activity()); Task task = testFlow.StartTest(); await task.ContinueWith(action => { Assert.IsInstanceOfType(action.Exception.InnerException, exceptionType); }); }
public async Task TestAdapter_TestFlow(Type exceptionType) { var adapter = new TestAdapter(); TestFlow testFlow = new TestFlow(adapter, (ctx) => { Exception innerException = (Exception)Activator.CreateInstance(exceptionType); var taskSource = new TaskCompletionSource <bool>(); taskSource.SetException(innerException); return(taskSource.Task); }) .Send(new Activity()); Task task = testFlow.StartTest() .ContinueWith(action => { Assert.IsInstanceOfType(action.Exception.InnerException, exceptionType); }); }