Example #1
0
 /// <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;
 }
Example #2
0
 /// <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
     });
 }
Example #4
0
 public void Add(IDependencySource dependency)
 {
     _arguments.Add(new CtorArgument
     {
         Parameter  = _constructor.GetParameters()[_arguments.Count],
         Dependency = dependency
     });
 }
Example #5
0
        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);
            }
        }
Example #6
0
        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);
            }
        }
Example #7
0
 internal TopicWhenCall(
     Topic topic,
     TimelinePoint point,
     IDependencySource dependencies,
     ClaimsPrincipal principal,
     CancellationToken cancellationToken)
     : base(topic, point, dependencies, principal, cancellationToken)
 {
     _newEvents = new Many <Event>();
 }
Example #8
0
        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()");
        }
Example #9
0
        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()");
        }
Example #10
0
 internal WhenCall(
     Flow flow,
     TimelinePoint point,
     IDependencySource dependencies,
     ClaimsPrincipal principal,
     CancellationToken cancellationToken)
     : base(flow, point)
 {
     Dependencies      = dependencies;
     Principal         = principal;
     CancellationToken = cancellationToken;
 }
Example #11
0
        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();
        }
Example #12
0
        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();
        }
Example #13
0
        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();
        }
Example #14
0
        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();
        }
Example #15
0
        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>;
        }
Example #16
0
        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>;
        }
Example #17
0
        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);
 }
Example #20
0
 public void InnerBuilder(IDependencySource inner)
 {
     _writer.Line(inner.Description);
 }
Example #21
0
 public void Add(IDependencySource item)
 {
     _items.Add(item);
 }
Example #22
0
 public void Dependency(IDependencySource source)
 {
     _writer.Line(source.Description);
 }
Example #23
0
 public Task CallWhen(Flow flow, TimelinePoint point, IDependencySource dependencies)
 {
     return(Events.CallWhen(flow, point, dependencies));
 }
Example #24
0
 public Setter(Type setterType, MemberInfo member, IDependencySource value)
 {
     _setterType = setterType;
     _member = member;
     AssignedValue = value;
 }
 public void Dependency(IDependencySource source)
 {
     _writer.Line(source.Description);
 }
 public void Add(IDependencySource item)
 {
     _items.Add(item);
 }
Example #27
0
 public void InnerBuilder(IDependencySource inner)
 {
     throw new NotImplementedException();
 }
Example #28
0
 public Setter(Type setterType, MemberInfo member, IDependencySource value)
 {
     _setterType   = setterType;
     _member       = member;
     AssignedValue = value;
 }
Example #29
0
 public void InnerBuilder(IDependencySource inner)
 {
     _writer.Line(inner.Description);
 }
Example #30
0
 public void Add(Type setterType, MemberInfo member, IDependencySource value)
 {
     Add(new Setter(setterType, member, value));
 }
Example #31
0
 public void Parameter(ParameterInfo parameter, IDependencySource source)
 {
     Items.Add("Parameter: " + parameter.Name + ", " + source.Description);
 }