Ejemplo n.º 1
0
        public void OnFinallyCalledFromFail()
        {
            var token  = new AsyncToken <TestResult>();
            var called = false;

            token.OnFinally(_ => called = true);
            token.Fail(new Exception());

            Assert.IsTrue(called);
        }
Ejemplo n.º 2
0
        public void OnFinallyCalledFromSucceed()
        {
            var token  = new AsyncToken <TestResult>();
            var called = false;

            token.OnFinally(_ => called = true);
            token.Succeed(new TestResult());

            Assert.IsTrue(called);
        }
Ejemplo n.º 3
0
        public void OnFinallyNotCalledAfterAbort()
        {
            var token  = new AsyncToken <TestResult>();
            var called = false;

            token.OnFinally(_ => called = true);
            token.Abort();
            token.Fail(new Exception());

            Assert.IsFalse(called);
        }