NSoft.NFramework.WithTryActionFixture.TryFunctionAsync_Test C# (CSharp) Method

TryFunctionAsync_Test() private method

private TryFunctionAsync_Test ( ) : void
return void
        public void TryFunctionAsync_Test() {
            var isCalled = false;
            var exceptionRaised = false;

            var result =
                With.TryFunctionAsync<int>(() => {
                                               Task.Factory.StartNew(() => { isCalled = true; })
                                                   .Wait();
                                               throw new AggregateException("AggEx", new InvalidOperationException("Test"));
                                           },
                                           null,
                                           age => age.Handle(ex => {
                                                                 if(ex is InvalidOperationException)
                                                                     exceptionRaised = true;

                                                                 return true;
                                                             }),
                                           () => {
                                               Assert.IsTrue(isCalled);
                                               Assert.IsTrue(exceptionRaised);
                                           });
        }
    }