public static TestFlow Do(this TestFlow testFlow, Action action)
        {
            return(new TestFlow(
                       async() =>
            {
                await testFlow.StartTestAsync().ConfigureAwait(false);

                action?.Invoke();
            },
                       testFlow));
        }
Exemplo n.º 2
0
        public async Task TestAdapter_TestFlow_ArgumentNullException()
        {
            var adapter = new TestAdapter(TestAdapter.CreateConversation("TestAdapter_TestFlow_ArgumentNullException"));

            TestFlow testFlow = new TestFlow(adapter, (ctx, cancellationToken) =>
            {
                Exception innerException = (Exception)Activator.CreateInstance(typeof(ArgumentNullException));
                var taskSource           = new TaskCompletionSource <bool>();
                taskSource.SetException(innerException);
                return(taskSource.Task);
            })
                                .Send(new Activity());
            await testFlow.StartTestAsync()
            .ContinueWith(action =>
            {
                Assert.IsType <ArgumentNullException>(action.Exception.InnerException);
            });
        }
Exemplo n.º 3
0
        public async Task TestAdapter_TestFlow(Type exceptionType)
        {
            var adapter = new TestAdapter();

            TestFlow testFlow = new TestFlow(adapter, (ctx, cancellationToken) =>
            {
                Exception innerException = (Exception)Activator.CreateInstance(exceptionType);
                var taskSource           = new TaskCompletionSource <bool>();
                taskSource.SetException(innerException);
                return(taskSource.Task);
            })
                                .Send(new Activity());
            await testFlow.StartTestAsync()
            .ContinueWith(action =>
            {
                Assert.IsInstanceOfType(action.Exception.InnerException, exceptionType);
            });
        }