/// <summary>
        /// Creates an execute-only activity test harness
        /// </summary>
        /// <typeparam name="TActivity"></typeparam>
        /// <typeparam name="TArguments"></typeparam>
        /// <param name="harness"></param>
        /// <returns></returns>
        public static ExecuteActivityTestHarness <TActivity, TArguments> ExecuteActivity <TActivity, TArguments>(this BusTestHarness harness)
            where TActivity : class, ExecuteActivity <TArguments>, new()
            where TArguments : class
        {
            var activityFactory = new FactoryMethodExecuteActivityFactory <TActivity, TArguments>(x => new TActivity());

            return(new ExecuteActivityTestHarness <TActivity, TArguments>(harness, activityFactory, x =>
            {
            }));
        }
        public static void ExecuteActivityHost <TActivity, TArguments>(
            this IReceiveEndpointConfigurator configurator, Func <TArguments, TActivity> controllerFactory)
            where TActivity : class, ExecuteActivity <TArguments>
            where TArguments : class
        {
            var factory       = new FactoryMethodExecuteActivityFactory <TActivity, TArguments>(controllerFactory);
            var specification = new ExecuteActivityHostSpecification <TActivity, TArguments>(factory);

            configurator.AddEndpointSpecification(specification);
        }
        /// <summary>
        /// Creates an execute-only activity test harness
        /// </summary>
        /// <typeparam name="TActivity"></typeparam>
        /// <typeparam name="TArguments"></typeparam>
        /// <param name="harness"></param>
        /// <param name="executeFactoryMethod"></param>
        /// <returns></returns>
        public static ExecuteActivityTestHarness <TActivity, TArguments> ExecuteActivity <TActivity, TArguments>(this BusTestHarness harness,
                                                                                                                 Func <TArguments, TActivity> executeFactoryMethod)
            where TActivity : class, ExecuteActivity <TArguments>
            where TArguments : class
        {
            var activityFactory = new FactoryMethodExecuteActivityFactory <TActivity, TArguments>(executeFactoryMethod);

            return(new ExecuteActivityTestHarness <TActivity, TArguments>(harness, activityFactory, x =>
            {
            }));
        }
示例#4
0
        public static InstanceSubscriptionConfigurator ExecuteActivityHost <TActivity, TArguments>(
            this SubscriptionBusServiceConfigurator configurator,
            Uri compensateAddress, Func <TArguments, TActivity> controllerFactory)
            where TActivity : ExecuteActivity <TArguments>
            where TArguments : class
        {
            var factory = new FactoryMethodExecuteActivityFactory <TActivity, TArguments>(controllerFactory);
            var host    = new ExecuteActivityHost <TActivity, TArguments>(compensateAddress, factory);

            return(configurator.Instance(host));
        }
        public static void ExecuteActivityHost <TActivity, TArguments>(this IReceiveEndpointConfigurator configurator,
                                                                       Func <TArguments, TActivity> activityFactory,
                                                                       Action <IExecuteActivityConfigurator <TActivity, TArguments> > configure = null)
            where TActivity : class, ExecuteActivity <TArguments>
            where TArguments : class
        {
            var factory       = new FactoryMethodExecuteActivityFactory <TActivity, TArguments>(activityFactory);
            var specification = new ExecuteActivityHostSpecification <TActivity, TArguments>(factory);

            configure?.Invoke(specification);

            configurator.AddEndpointSpecification(specification);
        }
示例#6
0
        public static void ExecuteActivityHost <TActivity, TArguments>(this IReceiveEndpointConfigurator configurator,
                                                                       Func <TArguments, TActivity> activityFactory,
                                                                       Action <IExecuteActivityConfigurator <TActivity, TArguments> > configure = null)
            where TActivity : class, IExecuteActivity <TArguments>
            where TArguments : class
        {
            if (activityFactory == null)
            {
                throw new ArgumentNullException(nameof(activityFactory));
            }

            var factory = new FactoryMethodExecuteActivityFactory <TActivity, TArguments>(activityFactory);

            ExecuteActivityHost(configurator, factory, configure);
        }