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