public SubstituteState(ISubstitutionContext substitutionContext) { SubstitutionContext = substitutionContext; SequenceNumberGenerator = substitutionContext.SequenceNumberGenerator; var substituteFactory = substitutionContext.SubstituteFactory; var callInfoFactory = new CallInfoFactory(); var callStack = new CallStack(); CallStack = callStack; ReceivedCalls = callStack; PendingSpecification = new PendingSpecification(); CallResults = new CallResults(callInfoFactory); CallSpecificationFactory = CallSpecificationFactoryFactoryYesThatsRight.CreateCallSpecFactory(); CallActions = new CallActions(callInfoFactory); var getCallSpec = new GetCallSpec(callStack, PendingSpecification, CallSpecificationFactory, CallActions); ConfigureCall = new ConfigureCall(CallResults, CallActions, getCallSpec); EventHandlerRegistry = new EventHandlerRegistry(); AutoValueProviders = new IAutoValueProvider[] { new AutoSubstituteProvider(substituteFactory), new AutoStringProvider(), new AutoArrayProvider(), #if NET4 new AutoTaskProvider(() => AutoValueProviders), #endif }; }
public SubstituteState(ISubstitutionContext substitutionContext, SubstituteConfig option) { SubstitutionContext = substitutionContext; SubstituteConfig = option; SequenceNumberGenerator = substitutionContext.SequenceNumberGenerator; var substituteFactory = substitutionContext.SubstituteFactory; var callInfoFactory = new CallInfoFactory(); var callStack = new CallStack(); CallStack = callStack; ReceivedCalls = callStack; PendingSpecification = new PendingSpecification(); CallResults = new CallResults(callInfoFactory); CallSpecificationFactory = CallSpecificationFactoryFactoryYesThatsRight.CreateCallSpecFactory(); CallActions = new CallActions(callInfoFactory); CallBaseExclusions = new CallBaseExclusions(); ResultsForType = new ResultsForType(callInfoFactory); var getCallSpec = new GetCallSpec(callStack, PendingSpecification, CallSpecificationFactory, CallActions); ConfigureCall = new ConfigureCall(CallResults, CallActions, getCallSpec); EventHandlerRegistry = new EventHandlerRegistry(); AutoValueProviders = new IAutoValueProvider[] { #if NET45 || NETSTANDARD1_5 new AutoObservableProvider(() => AutoValueProviders), new AutoQueryableProvider(), #endif new AutoSubstituteProvider(substituteFactory), new AutoStringProvider(), new AutoArrayProvider(), #if (NET4 || NET45 || NETSTANDARD1_5) new AutoTaskProvider(() => AutoValueProviders), #endif }; }
public SubstituteState(ISubstitutionContext substitutionContext) { SubstitutionContext = substitutionContext; SubstituteFactory = substitutionContext.SubstituteFactory; SequenceNumberGenerator = substitutionContext.SequenceNumberGenerator; CallInfoFactory = new CallInfoFactory(); var callStack = new CallStack(); CallStack = callStack; ReceivedCalls = callStack; PendingSpecification = new PendingSpecification(); CallResults = new CallResults(CallInfoFactory); CallSpecificationFactory = NewCallSpecificationFactory(); CallActions = new CallActions(CallInfoFactory); PropertyHelper = new PropertyHelper(); ResultSetter = new ResultSetter(CallStack, PendingSpecification, CallResults, CallSpecificationFactory, CallActions); EventHandlerRegistry = new EventHandlerRegistry(); ReceivedCallsExceptionThrower = new ReceivedCallsExceptionThrower(); DefaultForType = new DefaultForType(); AutoValueProviders = new IAutoValueProvider[] { new AutoSubstituteProvider(SubstituteFactory), new AutoStringProvider(), new AutoArrayProvider(), #if NET4 new AutoTaskProvider(() => AutoValueProviders), #endif }; }
public SubstituteFactory(ISubstitutionContext context, ICallRouterFactory callRouterFactory, IProxyFactory proxyFactory, ICallRouterResolver callRouterResolver) { _context = context; _callRouterFactory = callRouterFactory; _proxyFactory = proxyFactory; _callRouterResolver = callRouterResolver; }
public static SubstituteState Create(ISubstitutionContext substitutionContext) { var substituteFactory = substitutionContext.SubstituteFactory; var callInfoFactory = new CallInfoFactory(); var callStack = new CallStack(); var pendingSpecification = new PendingSpecification(); var callResults = new CallResults(callInfoFactory); var callSpecificationFactory = NewCallSpecificationFactory(); var callActions = new CallActions(callInfoFactory); var callFormatter = new CallFormatter(new ArgumentsFormatter(new ArgumentFormatter()), new ArgumentFormatInfoFactory()); var state = new object[] { callInfoFactory, callStack, pendingSpecification, callResults, callSpecificationFactory, substituteFactory, callActions, new PropertyHelper(), new ResultSetter(callStack, pendingSpecification, callResults, callSpecificationFactory, callActions), new EventHandlerRegistry(), new ReceivedCallsExceptionThrower(callFormatter), new DefaultForType(), new IAutoValueProvider[] { new AutoSubstituteProvider(substituteFactory), new AutoStringProvider(), new AutoArrayProvider()} }; return new SubstituteState(state); }
public override void Context() { base.Context(); _context = mock <ISubstitutionContext>(); _callRouterFactory = mock <ICallRouterFactory>(); _proxyFactory = mock <IProxyFactory>(); _callRouterResolver = mock <ICallRouterResolver>(); }
public CallRouter(ISubstituteState substituteState, ISubstitutionContext context, IRouteFactory routeFactory) { _substituteState = substituteState; _context = context; _routeFactory = routeFactory; UseDefaultRouteForNextCall(); }
public WhenCalled(ISubstitutionContext context, T substitute, Action <T> call, MatchArgs matchArgs) { _substitute = substitute; _call = call; _matchArgs = matchArgs; _callRouter = context.GetCallRouterFor(substitute); _routeFactory = context.GetRouteFactory(); }
public override void Context() { value = new object(); substitutionContext = mock<ISubstitutionContext>(); temporarilyChange(SubstitutionContext.Current) .to(substitutionContext) .via(x => SubstitutionContext.Current = x); }
public CallRouter(ISubstituteState substituteState, ISubstitutionContext context, IRouteFactory routeFactory) { _substituteState = substituteState; _context = context; _routeFactory = routeFactory; UseDefaultRouteForNextCall(); }
public ICallRouter Create(ISubstitutionContext substitutionContext) { var substituteState = SubstituteState.Create(substitutionContext); var receivedCalls = (IReceivedCalls) substituteState.FindInstanceFor(typeof(IReceivedCalls), null); var resultsSetter = (IResultSetter) substituteState.FindInstanceFor(typeof(IResultSetter), null); var callHandlerFactory = new CallHandlerFactory(); return new CallRouter(substitutionContext, receivedCalls, resultsSetter, new RouteFactory(substituteState, callHandlerFactory)); }
public override void Context() { _substitute = mock<Foo>(); _substituteFactory = mock<ISubstituteFactory>(); _substituteFactory.stub(x => x.Create<Foo>()).Return(_substitute); _context = mock<ISubstitutionContext>(); _context.stub(x => x.GetSubstituteFactory()).Return(_substituteFactory); temporarilyChange(() => SubstitutionContext.Current).to(_context); }
public CallRouter(ISubstitutionContext context, IReceivedCalls receivedCalls, IResultSetter resultSetter, IRouteFactory routeFactory) { _context = context; _receivedCalls = receivedCalls; _resultSetter = resultSetter; _routeFactory = routeFactory; UseDefaultRouteForNextCall(); }
public ICallRouter Create(ISubstitutionContext substitutionContext) { var substituteState = SubstituteState.Create(substitutionContext); var receivedCalls = (IReceivedCalls)substituteState.FindInstanceFor(typeof(IReceivedCalls), null); var resultsSetter = (IResultSetter)substituteState.FindInstanceFor(typeof(IResultSetter), null); var callHandlerFactory = new CallHandlerFactory(); return(new CallRouter(substitutionContext, receivedCalls, resultsSetter, new RouteFactory(substituteState, callHandlerFactory))); }
/// <summary> /// Creates an new <see cref="NSubstituteRegisterCallHandlerCommand"/> instance. /// </summary> public NSubstituteRegisterCallHandlerCommand( ISubstitutionContext substitutionContext, ICallResultCacheFactory callResultCacheFactory, ICallResultResolverFactory callResultResolverFactory) { this.SubstitutionContext = substitutionContext ?? throw new ArgumentNullException(nameof(substitutionContext)); this.CallResultCacheFactory = callResultCacheFactory ?? throw new ArgumentNullException(nameof(callResultCacheFactory)); this.CallResultResolverFactory = callResultResolverFactory ?? throw new ArgumentNullException(nameof(callResultResolverFactory)); }
public CallRouter(ISubstituteState substituteState, ISubstitutionContext context, IRouteFactory routeFactory) { _substituteState = substituteState; _context = context; _routeFactory = routeFactory; _receivedCalls = substituteState.ReceivedCalls; ConfigureCall = substituteState.ConfigureCall; UseDefaultRouteForNextCall(); }
public override void Context() { _routerForSubstitute = mock<ICallRouter>(); _substitute = mock<IFoo>(); _context = mock<ISubstitutionContext>(); _context.stub(x => x.GetCallRouterFor(_substitute)).Return(_routerForSubstitute); temporarilyChange(() => SubstitutionContext.Current).to(_context); }
public override void Context() { _value = new object(); _substitutionContext = mock<ISubstitutionContext>(); _substitutionContext .stub(x => x.LastCallShouldReturn(It.IsAny<IReturn>(), It.IsAny<MatchArgs>())) .IgnoreArguments() .WhenCalled(x => _returnValueSet = (IReturn) x.Arguments[0]); temporarilyChange(() => SubstitutionContext.Current).to(_substitutionContext); }
public override void Context() { _routerForSubstitute = mock <ICallRouter>(); _substitute = mock <IFoo>(); _context = mock <ISubstitutionContext>(); _context.stub(x => x.GetCallRouterFor(_substitute)).Return(_routerForSubstitute); temporarilyChange(() => SubstitutionContext.Current).to(_context); }
public CallRouter(ISubstituteState substituteState, ISubstitutionContext context, IRouteFactory routeFactory) { _substituteState = substituteState; _context = context; _routeFactory = routeFactory; _receivedCalls = substituteState.ReceivedCalls; ConfigureCall = substituteState.ConfigureCall; UseDefaultRouteForNextCall(); }
public override void Context() { _value = new object(); _substitutionContext = mock <ISubstitutionContext>(); _substitutionContext .stub(x => x.LastCallShouldReturn(It.IsAny <IReturn>(), It.IsAny <MatchArgs>())) .IgnoreArguments() .WhenCalled(x => _returnValueSet = (IReturn)x.Arguments[0]); temporarilyChange(() => SubstitutionContext.Current).to(_substitutionContext); }
public override void Context() { _callSpec = mock <ICallSpecification>(); _call = mock <ICall>(); _callSpecFactory = mock <ICallSpecificationFactory>(); _context = mock <ISubstitutionContext>(); _call.stub(x => x.Target()).Return(_target); _callSpecFactory.stub(x => x.CreateFrom(_call, MatchArgs.AsSpecifiedInCall)).Return(_callSpec); }
public override string Process(string text, ISubstitutionContext context) { if (!string.IsNullOrEmpty(text)) { return(text.Replace(Environment.NewLine, "")); } else { return(text); } }
public override void Context() { _types = new[] { typeof(Foo) }; _constructorArgs = new[] { new object() }; _substitute = mock <Foo>(); _substituteFactory = mock <ISubstituteFactory>(); _substituteFactory.stub(x => x.Create(_types, _constructorArgs)).Return(_substitute); _context = mock <ISubstitutionContext>(); _context.stub(x => x.SubstituteFactory).Return(_substituteFactory); temporarilyChange(() => SubstitutionContext.Current).to(_context); }
public override void Context() { _types = new[] { typeof(Foo) }; _constructorArgs = new[] { new object() }; _substitute = mock<Foo>(); _substituteFactory = mock<ISubstituteFactory>(); _substituteFactory.stub(x => x.Create(_types, _constructorArgs)).Return(_substitute); _context = mock<ISubstitutionContext>(); _context.stub(x => x.GetSubstituteFactory()).Return(_substituteFactory); temporarilyChange(() => SubstitutionContext.Current).to(_context); }
public override void Context() { _context = mock <ISubstitutionContext>(); _receivedCalls = mock <IReceivedCalls>(); _call = mock <ICall>(); _callSpecFromCall = mock <ICallSpecification>(); _callSpecificationFactory = mock <ICallSpecificationFactory>(); _exceptionThrower = new FakeExceptionThrower(); _callSpecFromCall.stub(x => x.IsSatisfiedBy(_call)).Return(true); _callSpecificationFactory.stub(x => x.CreateFrom(_call, _argMatching)).Return(_callSpecFromCall); }
public override void Context() { substitute = mock<Foo>(); substituteFactory = mock<ISubstituteFactory>(); substituteFactory.stub(x => x.Create<Foo>()).Return(substitute); context = mock<ISubstitutionContext>(); context.stub(x => x.GetSubstituteFactory()).Return(substituteFactory); temporarilyChange(SubstitutionContext.Current) .to(context) .via(x => SubstitutionContext.Current = x); }
public FluentQuerySubstitutionContext(ISubstitutionContext innerContext) { this.innerContext = innerContext; var callRouterFactory = new FluentCallRouterFactory(); var dynamicProxyFactory = new CastleDynamicProxyFactory(); var delegateFactory = new DelegateProxyFactory(); var proxyFactory = new ProxyFactory(delegateFactory, dynamicProxyFactory); var callRouteResolver = new CallRouterResolver(); this.substituteFactory = new SubstituteFactory(this, callRouterFactory, proxyFactory, callRouteResolver); }
public override void Context() { _call = mock <Action <IFoo> >(); _callbackWithArguments = args => { }; _matchArgs = MatchArgs.AsSpecifiedInCall; _context = mock <ISubstitutionContext>(); _substitute = mock <IFoo>(); _callRouter = mock <ICallRouter>(); _context.stub(x => x.GetCallRouterFor(_substitute)).Return(_callRouter); }
private string GetProcessedItem(ISubstitutionContext context, string input, MessageFieldType itemType) { Logger.WriteTrace(string.Format("{0} processing ", itemType), SeverityEnum.Trace); var worker = SubstitutionManager.GetWorker(context, itemType); var res = worker.PreProcess(input, context); var transformation = TransformationManager.GetTransformation(itemType, context); res = transformation.Transform(input, context, worker.OnPartLoaded); res = worker.PostProcess(input, context); Logger.WriteTrace(string.Format("{0} result: {1}", itemType, res), SeverityEnum.Trace); return(res); }
public Resolver(ISubstitutionContext context, string tempXslt, Func <string, string> processIncludes) { Logger = Application.Current.Logger; if (Logger == null) { throw new InvalidProgramException("No logger configured"); } this.tempXslt = tempXslt; this.processIncludes = processIncludes; this.m_context = context; }
public override void Context() { _sub = mock<IFoo>(); _substitutionContext = mock<ISubstitutionContext>(); _callRouter = mock<ICallRouter>(); _substitutionContext.stub(x => x.GetCallRouterFor(_sub)) .IgnoreArguments() .Return(_callRouter); _callRouter.stub(x => x.SetReturnForType(It.IsAny<Type>(), It.IsAny<IReturn>())) .IgnoreArguments() .WhenCalled(x => _returnValueSet = (IReturn)x.Arguments[1]); temporarilyChange(() => SubstitutionContext.Current).to(_substitutionContext); }
public override string Process(string text, ISubstitutionContext context) { try { var doc = XDocument.Parse(text); return(doc.Root.Value); } catch (Exception ex) { Logger.WriteTrace("Cannot remove tags. maybe they are not existed" + ex.Message, SeverityEnum.Verbose); return(text); } }
/// Switches the SubstitutionContext to use the custom substitution context that supports monobehaviours. /// The same context MUST be used for the entirety of a test, /// so this should be called once at the start of the Setup function. public static void BeginComponentContext() { if (SubstitutionContext.Current == componentSubstitutionContext) { Debug.LogError("Cannot call BeginComponentContext. It has already begun."); return; } CreateContext(); originalSubstitutionContext = SubstitutionContext.Current; SubstitutionContext.Current = componentSubstitutionContext; }
public override void Context() { _sub = mock <IFoo>(); _substitutionContext = mock <ISubstitutionContext>(); _callRouter = mock <ICallRouter>(); _substitutionContext.stub(x => x.GetCallRouterFor(_sub)) .IgnoreArguments() .Return(_callRouter); _callRouter.stub(x => x.SetReturnForType(It.IsAny <Type>(), It.IsAny <IReturn>())) .IgnoreArguments() .WhenCalled(x => _returnValueSet = (IReturn)x.Arguments[1]); temporarilyChange(() => SubstitutionContext.Current).to(_substitutionContext); }
public override void Context() { _context = mock <ISubstitutionContext>(); _call = mock <ICall>(); _state = mock <ISubstituteState>(); _receivedCalls = mock <IReceivedCalls>(); ConfigureCall = mock <IConfigureCall>(); _routeFactory = mock <IRouteFactory>(); _state.stub(x => x.ReceivedCalls).Return(_receivedCalls); _state.stub(x => x.ConfigureCall).Return(ConfigureCall); var recordReplayRoute = CreateRouteThatReturns(_returnValueFromRecordReplayRoute); recordReplayRoute.stub(x => x.IsRecordReplayRoute).Return(true); _routeFactory.stub(x => x.RecordReplay(_state)).Return(recordReplayRoute); }
private static void UninstallDiagContext(ISubstitutionContext originalCtx, IDiagnosticsLogger logger) { var current = SubstitutionContext.Current; if (!IsDiagContext(current)) { throw new InvalidOperationException( "You are trying to uninstall diagnostics context while current context is not diagnostics. " + "This is clear indication that something goes wrong." + Environment.NewLine + "Notice, the issue might also happen due to concurrency if you run multiple tests with diagnostics in parallel. " + "In that case please ensure that you run tests sequentially or install the hook globally on an assembly level."); } SubstitutionContext.Current = originalCtx; Log("Restored normal context", logger); }
public ISubstitutionWorker GetWorker(ISubstitutionContext context, MessageFieldType type) { switch (type) { case MessageFieldType.ForBody: return(new SubstitutionWorker(ClassContainer.Instance.Resolve <ILogger>(), new List <ISubstitution> { new ResourceSubstitution(), new FieldSubstitution(), new ComplexSubstitution(), new ContextVarsSubstitution(), }, new List <ISubstitution> { })); case MessageFieldType.ForSubject: return(new SubstitutionWorker(ClassContainer.Instance.Resolve <ILogger>(), new List <ISubstitution> { new ResourceSubstitution(), new FieldSubstitution(), new ContextVarsSubstitution(), }, new List <ISubstitution> { new RemoveXmlTagsSubstitution(), new OneLineSubstitution() })); case MessageFieldType.ForFrom: case MessageFieldType.ForReplay: return(new SubstitutionWorker(ClassContainer.Instance.Resolve <ILogger>(), new List <ISubstitution> { new ResourceSubstitution(), new FieldSubstitution(), new ContextVarsSubstitution(), }, new List <ISubstitution> { new RemoveXmlTagsSubstitution(), new OneLineSubstitution() })); default: return(new SubstitutionWorker(ClassContainer.Instance.Resolve <ILogger>(), new List <ISubstitution>(), new List <ISubstitution>())); } }
private static void CreateContext() { if (componentSubstitutionContext != null) { return; } var callRouterFactory = new CallRouterFactory(); var dynamicProxyFactory = new ComponentDynamicProxyFactory(); var delegateFactory = new DelegateProxyFactory(); var proxyFactory = new ComponentProxyFactory(delegateFactory, dynamicProxyFactory); var callRouteResolver = new CallRouterResolver(); var substituteFactory = new ComponentSubstituteFactory(callRouterFactory, proxyFactory, callRouteResolver); componentSubstitutionContext = new SubstitutionContext(substituteFactory); substituteFactory._context = componentSubstitutionContext; }
internal static IDisposable Install(IDiagnosticsLogger logger) { ISubstitutionContext originalContext; lock (InstallLock) { ISubstitutionContext diagnosticsContext = CreateContext(logger); originalContext = InstallDiagContext(diagnosticsContext, logger); } return(new DelegatingDisposable(() => { lock (InstallLock) { UninstallDiagContext(originalContext, logger); } })); }
public override string Process(string text, ISubstitutionContext context) { var res = text; foreach (Match m in Regex.Matches(text, Pattern)) { try { var value = context.GetContextValue(m.Groups[1].Value); if (value != null) { res = res.Replace(m.Value, value); } } catch (Exception ex) { Logger.WriteTrace(ex, SeverityEnum.Error); } } return(res); }
public SubstituteState(ISubstitutionContext substitutionContext, SubstituteConfig option) { SubstitutionContext = substitutionContext; SubstituteConfig = option; SequenceNumberGenerator = substitutionContext.SequenceNumberGenerator; var substituteFactory = substitutionContext.SubstituteFactory; var callInfoFactory = new CallInfoFactory(); var callCollection = new CallCollection(); CallCollection = callCollection; ReceivedCalls = callCollection; PendingSpecification = new PendingSpecification(substitutionContext); CallResults = new CallResults(callInfoFactory); AutoValuesCallResults = new CallResults(callInfoFactory); CallSpecificationFactory = CallSpecificationFactoryFactoryYesThatsRight.CreateCallSpecFactory(); CallActions = new CallActions(callInfoFactory); CallBaseExclusions = new CallBaseExclusions(); ResultsForType = new ResultsForType(callInfoFactory); CustomHandlers = new CustomHandlers(this); var getCallSpec = new GetCallSpec(callCollection, PendingSpecification, CallSpecificationFactory, CallActions); ConfigureCall = new ConfigureCall(CallResults, CallActions, getCallSpec); EventHandlerRegistry = new EventHandlerRegistry(); AutoValueProviders = new IAutoValueProvider[] { #if NET45 || NETSTANDARD1_5 new AutoObservableProvider(() => AutoValueProviders), new AutoQueryableProvider(), #endif new AutoSubstituteProvider(substituteFactory), new AutoStringProvider(), new AutoArrayProvider(), #if (NET4 || NET45 || NETSTANDARD1_5) new AutoTaskProvider(() => AutoValueProviders), #endif }; }
public override string Process(string text, ISubstitutionContext context) { string res = text; foreach (Match m in Regex.Matches(res, Pattern)) { try { ModifiersCollection modifiers = ModifiersCollection.Parse(m.Groups[2].Value); string fieldTextValue = context.GetCurrentFieldValue(m.Groups[1].Value, modifiers); if (fieldTextValue != null) { res = res.Replace(m.Value, fieldTextValue); } } catch (Exception ex) { Logger.WriteTrace(ex, SeverityEnum.Error); } } return(res); }
public override string Transform(string template, ISubstitutionContext context, Func <string, string> partIncludedCallback) { try { string res = string.Empty; var xml = GetTemplateData(context); var log = new StringBuilder(); log.AppendLine("Applying XSLT"); log.AppendLine("Template:"); log.AppendLine(template); if (!template.IsXslt()) { log.AppendLine("Template is not xslt"); res = template; } else { log.AppendLine("Incoming XML"); log.AppendLine(xml); res = xml.ApplyXslt(template, context, partIncludedCallback); log.AppendLine("Result:"); log.AppendLine(res); } Logger.WriteTrace(log.ToString(), SeverityEnum.Verbose); return(res); } catch (XsltException ex) { Logger.WriteTrace("Cannot parse or transform template. maybe because it is not xslt template", ex, SeverityEnum.Warning); return(template); } catch (Exception ex) { Logger.WriteTrace("ERROR DURIN|G GEMERATING OUTPUT HTML", ex, SeverityEnum.CriticalError); return(template); } }
public override string Process(string text, ISubstitutionContext context) { var res = text; foreach (Match m in Regex.Matches(res, @"\{\$(.+)\}")) { try { string value = null; switch (m.Groups[1].Value.ToLower()) { case "changes": value = GetGhanges(context); break; default: value = "no " + m.Value; break; } res = res.Replace(m.Value, value); } catch (Exception ex) { Logger.WriteTrace(ex, SeverityEnum.Error); } } return(res); }
private static ISubstitutionContext InstallDiagContext(ISubstitutionContext newCtx, IDiagnosticsLogger logger) { if (!IsDiagContext(newCtx)) { throw new ArgumentException($"Diagnostics context is expected. Actual context type: {newCtx.GetType().FullName}"); } var oldContext = SubstitutionContext.Current; if (IsDiagContext(oldContext)) { throw new InvalidOperationException( "You are trying to install diagnostics context while other diagnostics context is already installed. " + "This scenario is not supported and might indicate that something is going wrong." + Environment.NewLine + "Notice, the issue might also happen due to concurrency if you run multiple tests with diagnostics in parallel. " + "In that case please ensure that you run tests sequentially or install the hook globally on an assembly level."); } SubstitutionContext.Current = newCtx; Log("Installed diagnostics context", logger); return(oldContext); }
public ICallRouter Create(ISubstitutionContext substitutionContext, SubstituteConfig config) { var state = new SubstituteState(substitutionContext, config); return new CallRouter(state, substitutionContext, new FluentQueryCompatibleRouteFactory()); }
public override void Context() { _value = new object(); _substitutionContext = mock<ISubstitutionContext>(); temporarilyChange(() => SubstitutionContext.Current).to(_substitutionContext); }
public CallFactory(ISubstitutionContext context) { _context = context; }
public CallSpecificationFactory(ISubstitutionContext context) { _context = context; }
public ICallRouter Create(ISubstitutionContext substitutionContext) { var substituteState = new SubstituteState(substitutionContext); var routePartsFactory = new RoutePartsFactory(substituteState); return new CallRouter(substitutionContext, substituteState.ResultSetter, new RouteFactory(routePartsFactory)); }
public AddCallToQueryResultHandler(ISubstitutionContext context, ICallSpecificationFactory callSpecificationFactory) { _context = context; _callSpecificationFactory = callSpecificationFactory; }
public PendingSpecification(ISubstitutionContext substitutionContext) { _substitutionContext = substitutionContext; }
public ICallRouter Create(ISubstitutionContext substitutionContext, SubstituteConfig config) { var substituteState = new SubstituteState(substitutionContext, config); return new CallRouter(substituteState, substitutionContext, new RouteFactory()); }
public IInvocationHandler CreateInvocationHandler(ISubstitutionContext substitutionContext) { return new InvocationHandler(new InvocationStack(), new InvocationResults(null), substitutionContext); }
public ClearLastCallRouterHandler(ISubstitutionContext context) { _context = context; }