public void Around()
        {
            chain.Around(CreateActionDecorator("abc", "xyz", 0));
            chain.Around(CreateActionDecorator("def", "uvw", 1));
            chain.Around(CreateActionDecorator("ghi", "rst", 2));
            chain.Action("key", 42);

            AssertTraceEquals("key,42: ghi,2", "key,42: def,1", "key,42: abc,0", "key,42: xyz,0", "key,42: uvw,1", "key,42: rst,2");
        }
Пример #2
0
        public void Around()
        {
            chain.Around(CreateActionDecorator("abc", "xyz"));
            chain.Around(CreateActionDecorator("def", "uvw"));
            chain.Around(CreateActionDecorator("ghi", "rst"));
            chain.Action("key");

            AssertTraceEquals("key: ghi", "key: def", "key: abc", "key: xyz", "key: uvw", "key: rst");
        }
 private void AddDecorator(ActionChain <PatternTestInstanceState> chain)
 {
     chain.Around(delegate(PatternTestInstanceState childState, Action <PatternTestInstanceState> inner)
     {
         TestShell.RunGuarded(delegate
         {
             using (ReadLockCookie.Create())
             {
                 inner(childState);
             }
         });
     });
 }
Пример #4
0
 private void WrapDefaultAction(ActionChain <PatternTestInstanceState> chain, Action <PatternTestInstanceState> decoratorAction)
 {
     chain.Around((testInstanceState, decoratedAction) =>
     {
         try
         {
             testInstanceState.Data.SetValue(defaultActionKey, decoratedAction);
             decoratorAction(testInstanceState);
         }
         finally
         {
             testInstanceState.Data.RemoveValue(defaultActionKey);
         }
     });
 }
Пример #5
0
        /// <inheritdoc />
        protected override void DecorateTest(IPatternScope scope, ICodeElementInfo codeElement)
        {
            ActionChain <PatternTestInstanceState> executeTestInstanceChain = scope.TestBuilder.TestInstanceActions.ExecuteTestInstanceChain;

            executeTestInstanceChain.Around((state, inner) => ExecuteTestInstanceChainCatchExceptionDecorator(inner, state));
        }