public AbstractStrategyTest() { this.runSyntaxBuilder = A.Fake <ISyntaxBuilder <IExtension> >(); this.shutdownSyntaxBuilder = A.Fake <ISyntaxBuilder <IExtension> >(); this.testee = new TestableAbstractStrategy(this.runSyntaxBuilder, this.shutdownSyntaxBuilder); }
public SyntaxBuilderTest() { this.executionChainingBuilder = new StringBuilder(); this.executableFactory = new Mock <IExecutableFactory <ICustomExtension> >(); this.testee = new SyntaxBuilder <ICustomExtension>(this.executableFactory.Object); }
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)); }
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>()); }
/// <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()); }
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()); }
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")); }
/// <inheritdoc /> protected override void DefineShutdownSyntax(ISyntaxBuilder <IComplexExtension> builder) { builder .Execute(e => e.Shutdown()) .End.With(new DisposeExtensionBehavior()); }
/// <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()); }
/// <summary> /// Initializes a new instance of the <see cref="AbstractStrategy<TExtension>"/> 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; }
/// <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);
/// <inheritdoc /> protected override void DefineRunSyntax(ISyntaxBuilder <ISimpleExtension> builder) { builder .Execute(x => x.Start()); }
public TestableAbstractStrategy(ISyntaxBuilder <IExtension> runSyntaxBuilder, ISyntaxBuilder <IExtension> shutdownSyntaxBuilder) : base(runSyntaxBuilder, shutdownSyntaxBuilder) { }
protected override void DefineShutdownSyntax(ISyntaxBuilder <IExtension> builder) { this.ShutdownSyntaxBuilder = builder; }
protected override void DefineShutdownSyntax(ISyntaxBuilder <ICustomExtensionWithExtensionConfiguration> builder) { }