/// <summary> /// FOR TESTING ONLY! /// </summary> /// <param name="pluginType"></param> /// <param name="instance"></param> /// <param name="inner"></param> /// <param name="interceptionPlan"></param> public BuildPlan(Type pluginType, Instance instance, IDependencySource inner, IInterceptionPlan interceptionPlan) { _pluginType = pluginType; _instance = instance; _inner = inner; _interceptionPlan = interceptionPlan; }
/// <summary> /// FOR TESTING ONLY! /// </summary> /// <param name="pluginType"></param> /// <param name="instance"></param> /// <param name="inner"></param> /// <param name="interceptionPlan"></param> public BuildPlan(Type pluginType, Instance instance, IDependencySource inner, IInterceptionPlan interceptionPlan) { PluginType = pluginType; Instance = instance; Inner = inner; _interceptionPlan = interceptionPlan; }
public void Add(IDependencySource dependency) { _arguments.Add(new CtorArgument { Parameter = _constructor.GetParameters()[_arguments.Count], Dependency = dependency }); }
public async Task CallWhen(Flow flow, TimelinePoint point, IDependencySource dependencies) { var e = Get(point.EventType.Key, strict: false); if (e != null) { await e.CallWhen(flow, point, dependencies); } }
public async Task CallWhen(Flow flow, TimelinePoint point, IDependencySource dependencies) { CallGiven(flow, point); foreach (var when in When.SelectMethods(point)) { await when.Call(flow, point.Event, dependencies); } }
internal TopicWhenCall( Topic topic, TimelinePoint point, IDependencySource dependencies, ClaimsPrincipal principal, CancellationToken cancellationToken) : base(topic, point, dependencies, principal, cancellationToken) { _newEvents = new Many <Event>(); }
public void the_construction_blows_up_get_the_description_of_the_instance() { theInner = new ConcreteBuild <ThrowsUpTarget>(); var ex = Exception <StructureMapBuildException> .ShouldBeThrownBy(() => { thePlan.Build(theSession, theSession); }); ex.Message.ShouldContain(theInstance.Description); ex.Message.ShouldContain(thePlan.Description); ex.Message.ShouldContain("new ThrowsUpTarget()"); }
public void the_construction_blows_up_get_the_description_of_the_instance() { theInner = new ConcreteBuild<ThrowsUpTarget>(); var ex = Exception<StructureMapBuildException>.ShouldBeThrownBy(() => { thePlan.Build(theSession, theSession); }); ex.Message.ShouldContain(theInstance.Description); ex.Message.ShouldContain(thePlan.Description); ex.Message.ShouldContain("new ThrowsUpTarget()"); }
internal WhenCall( Flow flow, TimelinePoint point, IDependencySource dependencies, ClaimsPrincipal principal, CancellationToken cancellationToken) : base(flow, point) { Dependencies = dependencies; Principal = principal; CancellationToken = cancellationToken; }
public void SetUp() { theTarget = new BuildTarget(); theInstance = new ObjectInstance(theTarget); theInterceptors = new IInterceptor[0]; theInner = Constant.For(theTarget); _plan = new Lazy <BuildPlan>(() => new BuildPlan(typeof(IBuildTarget), theInstance, theInner, new Policies(), theInterceptors)); theSession = new FakeBuildSession(); }
public void SetUp() { theTarget = new BuildTarget(); theInstance = new ObjectInstance(theTarget); theInterceptors = new IInterceptor[0]; theInner = Constant.For(theTarget); _plan = new Lazy<BuildPlan>(() => new BuildPlan(typeof (IBuildTarget), theInstance, theInner, new Policies(), theInterceptors)); theSession = new FakeBuildSession(); }
public BuildPlanTester() { theTarget = new BuildTarget(); theInstance = new ObjectInstance(theTarget); theInterceptors = new IInterceptor[0]; theInner = Constant.For(theTarget); plan = new Lazy <BuildPlan>( () => new BuildPlan(typeof(IBuildTarget), theInstance, theInner, Policies.Default(), theInterceptors)); theSession = new FakeBuildSession(); }
public BuildPlanTester() { theTarget = new BuildTarget(); theInstance = new ObjectInstance(theTarget); theInterceptors = new IInterceptor[0]; theInner = Constant.For(theTarget); plan = new Lazy<BuildPlan>( () => new BuildPlan(typeof(IBuildTarget), theInstance, theInner, Policies.Default(), theInterceptors)); theSession = new FakeBuildSession(); }
public BuildPlan(Type pluginType, Instance instance, IDependencySource inner, Policies policies, IEnumerable<IInterceptor> interceptors) { _pluginType = pluginType; _instance = instance; _inner = inner; if (interceptors.Any()) { _interceptionPlan = new InterceptionPlan(pluginType, _inner, policies, interceptors); } var @delegate = ToDelegate(); _func = @delegate as Func<IBuildSession, IContext, object>; }
public BuildPlan(Type pluginType, Instance instance, IDependencySource inner, Policies policies, IEnumerable <IInterceptor> interceptors) { PluginType = pluginType; Instance = instance; Inner = inner; if (interceptors.Any()) { _interceptionPlan = new InterceptionPlan(pluginType, Inner, policies, interceptors); } var @delegate = ToDelegate(); _func = @delegate as Func <IBuildSession, IContext, object>; }
public InterceptionPlan(Type pluginType, IDependencySource inner, Policies policies, IEnumerable <IInterceptor> interceptors) { _pluginType = pluginType; _inner = inner; _policies = policies; _interceptors = interceptors; _variable = Expression.Variable(_inner.ReturnedType, "x"); _activators = findActivatorGroups(); _decorators = _interceptors.Where(x => x.Role == InterceptorRole.Decorates); var badDecorators = _decorators.Where(x => x.Accepts != pluginType || x.Returns != pluginType).ToArray(); if (badDecorators.Any()) { var decoratorDescription = string.Join(", ", badDecorators.Select(x => x.Description)); var description = "Invalid decorators for type {0}: {1}".ToFormat(pluginType.GetTypeName(), decoratorDescription); throw new StructureMapBuildPlanException(description); } }
public void InnerBuilder(IDependencySource inner) { throw new NotImplementedException(); }
public void Parameter(ParameterInfo parameter, IDependencySource source) { Items.Add("Parameter: " + parameter.Name + ", " + source.Description); }
public void InnerBuilder(IDependencySource inner) { _writer.Line(inner.Description); }
public void Add(IDependencySource item) { _items.Add(item); }
public void Dependency(IDependencySource source) { _writer.Line(source.Description); }
public Task CallWhen(Flow flow, TimelinePoint point, IDependencySource dependencies) { return(Events.CallWhen(flow, point, dependencies)); }
public Setter(Type setterType, MemberInfo member, IDependencySource value) { _setterType = setterType; _member = member; AssignedValue = value; }
public void Add(Type setterType, MemberInfo member, IDependencySource value) { Add(new Setter(setterType, member, value)); }