Esempio n. 1
0
        public AbstractStrategyTest()
        {
            this.runSyntaxBuilder      = A.Fake <ISyntaxBuilder <IExtension> >();
            this.shutdownSyntaxBuilder = A.Fake <ISyntaxBuilder <IExtension> >();

            this.testee = new TestableAbstractStrategy(this.runSyntaxBuilder, this.shutdownSyntaxBuilder);
        }
Esempio n. 2
0
        public SyntaxBuilderTest()
        {
            this.executionChainingBuilder = new StringBuilder();
            this.executableFactory        = new Mock <IExecutableFactory <ICustomExtension> >();

            this.testee = new SyntaxBuilder <ICustomExtension>(this.executableFactory.Object);
        }
Esempio n. 3
0
 protected override void DefineShutdownSyntax(ISyntaxBuilder <ISensor> builder)
 {
     builder
     .Execute(sensor => sensor.StopObservation())
     .With(() => this.standardKernel.Value.Get <IStopHeartbeat>())
     .End
     .With(new DisposeExtensionBehavior());
 }
 protected override void DefineShutdownSyntax(ISyntaxBuilder <ICustomExtension> syntax)
 {
     syntax
     .Execute(() => CustomExtensionBase.DumpAction("CustomShutdown"))
     .Execute(() => "ShutdownTest", (extension, ctx) => extension.Unregister(ctx))
     .Execute(() => this.ShutdownInitializeConfiguration(), (extension, dictionary) => extension.DeConfigure(dictionary))
     .Execute(extension => extension.Stop());
 }
 protected override void DefineRunSyntax(ISyntaxBuilder <ICustomExtension> builder)
 {
     builder
     .Execute(() => CustomExtensionBase.DumpAction("CustomRun"))
     .Execute(extension => extension.Start())
     .Execute(() => this.RunInitializeConfiguration(), (extension, dictionary) => extension.Configure(dictionary))
     .Execute(extension => extension.Initialize())
     .Execute(() => "RunTest", (extension, ctx) => extension.Register(ctx));
 }
Esempio n. 6
0
 protected override void DefineRunSyntax(ISyntaxBuilder <ISensor> builder)
 {
     builder
     .Begin
     .With(() => this.Kernel.Get <ExtensionConfigurationSectionBehavior>())
     .Execute(() => GetVphtMessageBus(), (sensor, messagebus) => sensor.MessageBusInitialized(messagebus))
     .Execute(() => GetVphtDataBus(), (sensor, databus) => sensor.DataBusInitialized(databus))
     .Execute(sensor => sensor.Initialize())
     .Execute(sensor => sensor.StartObservation())
     .With(() => this.Kernel.Get <IMakeAwareOfHeartbeat>())
     .With(() => this.Kernel.Get <IStartHeartbeat>());
 }
Esempio n. 7
0
 /// <inheritdoc />
 protected override void DefineRunSyntax(ISyntaxBuilder <IComplexExtension> builder)
 {
     builder
     .Begin
     .With(new ConfigurationSectionBehavior())
     .With(new ExtensionConfigurationSectionBehavior())
     .Execute(e => e.Start())
     .Execute(() => this.funqlets, (e, ctx) => e.ContainerInitializing(ctx))
     .With(flts => new FunqletProvidingBehavior(flts))
     .Execute(() => this.BuildContainer(), (e, ctx) => e.ContainerInitialized(ctx))
     .With(ctx => ctx.Resolve <IBehavior <IComplexExtension> >())
     .Execute(e => e.Ready());
 }
Esempio n. 8
0
 protected override void DefineShutdownSyntax(ISyntaxBuilder <ICustomExtension> builder)
 {
     builder
     .Begin
     .With(new Behavior("shutdown first beginning"))
     .With(() => new Behavior("shutdown second beginning"))
     .Execute(() => CustomExtensionBase.DumpAction("CustomShutdown"))
     .Execute(() => "ShutdownTest", (extension, ctx) => extension.Unregister(ctx))
     .With(context => new BehaviorWithStringContext(context, "ShutdownTestValueFirst"))
     .With(context => new BehaviorWithStringContext(context, "ShutdownTestValueSecond"))
     .Execute(() => this.ShutdownInitializeConfiguration(), (extension, dictionary) => extension.DeConfigure(dictionary))
     .With(dictionary => new BehaviorWithConfigurationContext(dictionary, "ShutdownFirstValue", "ShutdownTestValue"))
     .With(dictionary => new BehaviorWithConfigurationContext(dictionary, "ShutdownSecondValue", "ShutdownTestValue"))
     .Execute(extension => extension.Stop())
     .With(new Behavior("shutdown first stop"))
     .With(() => new Behavior("shutdown second stop"))
     .End
     .With(new Behavior("shutdown first end"))
     .With(() => new Behavior("shutdown second end"))
     .With(new DisposeExtensionBehavior());
 }
Esempio n. 9
0
 protected override void DefineRunSyntax(ISyntaxBuilder <ICustomExtension> builder)
 {
     builder
     .Begin
     .With(new Behavior("run first beginning"))
     .With(() => new Behavior("run second beginning"))
     .Execute(() => CustomExtensionBase.DumpAction("CustomRun"))
     .Execute(extension => extension.Start())
     .With(new Behavior("run first start"))
     .With(() => new Behavior("run second start"))
     .Execute(() => this.RunInitializeConfiguration(), (extension, dictionary) => extension.Configure(dictionary))
     .With(dictionary => new BehaviorWithConfigurationContext(dictionary, "RunFirstValue", "RunTestValue"))
     .With(dictionary => new BehaviorWithConfigurationContext(dictionary, "RunSecondValue", "RunTestValue"))
     .Execute(extension => extension.Initialize())
     .With(new Behavior("run first initialize"))
     .With(() => new Behavior("run second initialize"))
     .Execute(() => "RunTest", (extension, context) => extension.Register(context))
     .With(context => new BehaviorWithStringContext(context, "RunTestValueFirst"))
     .With(context => new BehaviorWithStringContext(context, "RunTestValueSecond"))
     .End
     .With(new Behavior("run first end"))
     .With(() => new Behavior("run second end"));
 }
Esempio n. 10
0
 /// <inheritdoc />
 protected override void DefineShutdownSyntax(ISyntaxBuilder <IComplexExtension> builder)
 {
     builder
     .Execute(e => e.Shutdown())
     .End.With(new DisposeExtensionBehavior());
 }
Esempio n. 11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ComplexStrategy"/> class.
 /// </summary>
 /// <param name="runSyntaxBuilder">The run syntax builder.</param>
 /// <param name="shutdownSyntaxBuilder">The shutdown syntax builder.</param>
 protected ComplexStrategy(ISyntaxBuilder <IComplexExtension> runSyntaxBuilder, ISyntaxBuilder <IComplexExtension> shutdownSyntaxBuilder)
     : base(runSyntaxBuilder, shutdownSyntaxBuilder)
 {
     this.funqlets  = new Collection <IFunqlet>();
     this.container = new Lazy <Container>(() => new Container());
 }
 protected override void DefineRunSyntax(ISyntaxBuilder <ICustomExtensionWithExtensionConfiguration> builder)
 {
     builder.Begin.With(new ExtensionConfigurationSectionBehavior());
 }
Esempio n. 13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AbstractStrategy&lt;TExtension&gt;"/> class.
 /// </summary>
 /// <param name="runSyntaxBuilder">The run syntax builder.</param>
 /// <param name="shutdownSyntaxBuilder">The shutdown syntax builder.</param>
 protected AbstractStrategy(ISyntaxBuilder <TExtension> runSyntaxBuilder, ISyntaxBuilder <TExtension> shutdownSyntaxBuilder)
 {
     this.shutdownSyntaxBuilder = shutdownSyntaxBuilder;
     this.runSyntaxBuilder      = runSyntaxBuilder;
 }
Esempio n. 14
0
 /// <summary>
 /// Fluently defines the shutdown syntax on the specified builder.
 /// </summary>
 /// <param name="builder">The syntax builder</param>
 protected abstract void DefineShutdownSyntax(ISyntaxBuilder <TExtension> builder);
Esempio n. 15
0
 /// <inheritdoc />
 protected override void DefineRunSyntax(ISyntaxBuilder <ISimpleExtension> builder)
 {
     builder
     .Execute(x => x.Start());
 }
Esempio n. 16
0
 public TestableAbstractStrategy(ISyntaxBuilder <IExtension> runSyntaxBuilder, ISyntaxBuilder <IExtension> shutdownSyntaxBuilder)
     : base(runSyntaxBuilder, shutdownSyntaxBuilder)
 {
 }
Esempio n. 17
0
 protected override void DefineShutdownSyntax(ISyntaxBuilder <IExtension> builder)
 {
     this.ShutdownSyntaxBuilder = builder;
 }
 protected override void DefineShutdownSyntax(ISyntaxBuilder <ICustomExtensionWithExtensionConfiguration> builder)
 {
 }