protected override void ExecuteTest()
        {
            callContext = new CacheCallStackContext();

            // First service call context
            callContext.Enter(invocations[0]); // Outer service ENTER
            callContext.Enter(invocations[1]); // Inner service ENTER
            callContext.Exit();                // Inner service EXIT
            fakeInterceptor.MarkAsProcessed(); // Result modified by upstream interceptor
            callContext.Exit();                // Outer service EXIT

            // Starting a second service call
            callContext.Enter(invocations[2]); // Outer service ENTER
            callContext.Enter(invocations[3]); // Inner service ENTER
            callContext.Exit();                // Inner service EXIT
        }
示例#2
0
        private bool TryServeValueFromCache(IInvocation invocation, StageResult stageResult,
                                            CacheCallStackContext callStackContext, string cacheKey, ICacheProvider cacheProvider)
        {
            object cacheEntry;

            if (cacheProvider.TryGetCachedObject(cacheKey, out cacheEntry))
            {
                if (cacheEntry == null)
                {
                    invocation.ReturnValue = null;
                }
                else
                {
                    SetReturnValueFromCacheEntry(invocation, cacheEntry);
                }

                stageResult.Proceed = false;

                // We're not going to run the "After" stage, and so we need to process exiting now
                callStackContext.Exit();

                return true;
            }

            return false;
        }
 protected override void ExecuteTest()
 {
     callContext = new CacheCallStackContext();
     callContext.Enter(invocations[0]);
     callContext.Enter(invocations[1]);
     callContext.Exit();
 }