예제 #1
0
        public static MocksRepository ResolveRepository(UnresolvedContextBehavior unresolvedContextBehavior)
        {
            foreach (var resolver in registeredContextResolvers)
            {
                var repo = resolver.ResolveRepository(unresolvedContextBehavior);
                if (repo != null)
                {
                    lastFrameworkAwareRepository = repo;
                    return(repo);
                }
            }

            if (lastFrameworkAwareRepository != null && !ProfilerInterceptor.IsProfilerAttached)
            {
                return(lastFrameworkAwareRepository);
            }

            return(LocalMockingContextResolver.ResolveRepository(unresolvedContextBehavior));
        }
예제 #2
0
        public static MocksRepository ResolveRepository(UnresolvedContextBehavior unresolvedContextBehavior)
        {
            if (unresolvedContextBehavior != UnresolvedContextBehavior.DoNotCreateNew)
            {
                DebugView.TraceEvent(IndentLevel.StackTrace, () => String.Format("Resolving repository with unresolved context behavior {0}", unresolvedContextBehavior));
            }

            foreach (var resolver in registeredContextResolvers)
            {
                var repo = resolver.ResolveRepository(unresolvedContextBehavior);
                if (repo != null)
                {
                    lastFrameworkAwareRepository = repo;
                    return(repo);
                }
            }

            if (lastFrameworkAwareRepository != null && !ProfilerInterceptor.IsProfilerAttached)
            {
                return(lastFrameworkAwareRepository);
            }

            return(LocalMockingContextResolver.ResolveRepository(unresolvedContextBehavior));
        }