/// <summary>
 ///     Initializes a new instance of the <see cref="SortWithCultureEngine" /> class.
 ///     Create An Engine for unit testing.
 /// </summary>
 /// <param name="recordCopierFactory">Factory to create copiers</param>
 /// <param name="inputPropertyFactory">Factory to create input properties</param>
 /// <param name="outputHelperFactory">Factory to create output helpers</param>
 internal SortWithCultureEngine(
     IRecordCopierFactory recordCopierFactory,
     IInputPropertyFactory inputPropertyFactory,
     IOutputHelperFactory outputHelperFactory)
     : base(recordCopierFactory, outputHelperFactory)
 {
     this.Input               = inputPropertyFactory.Build(recordCopierFactory, this.ShowDebugMessages);
     this.Input.InitCalled   += (sender, args) => args.Success = this.InitFunc(this.Input.RecordInfo);
     this.Input.RecordPushed += (sender, args) => args.Success = this.PushFunc(args.RecordData);
     this.Input.Closed       += sender => this.ClosedAction();
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NumberParserEngine"/> class.
 /// Create An NumberParserEngine for unit testing.
 /// </summary>
 /// <param name="recordCopierFactory">Factory to create copiers</param>
 /// <param name="inputPropertyFactory">Factory to create input properties</param>
 /// <param name="outputHelperFactory">Factory to create output helpers</param>
 internal NumberParserEngine(
     IRecordCopierFactory recordCopierFactory,
     IInputPropertyFactory inputPropertyFactory,
     IOutputHelperFactory outputHelperFactory)
     : base(recordCopierFactory, outputHelperFactory)
 {
     this.Input                  = inputPropertyFactory.Build(recordCopierFactory, this.ShowDebugMessages);
     this.Input.InitCalled      += this.OnInit;
     this.Input.ProgressUpdated += (sender, args) => this.Output?.UpdateProgress(args.Progress, true);
     this.Input.RecordPushed    += this.OnRecordPushed;
     this.Input.Closed          += sender => this.Output?.Close(true);
 }
Ejemplo n.º 3
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="BaseEngine{T}" /> class.
        /// </summary>
        /// <param name="recordCopierFactory">Factory to create copiers</param>
        /// <param name="outputHelperFactory">Factory to create output helpers</param>
        protected BaseEngine(IRecordCopierFactory recordCopierFactory, IOutputHelperFactory outputHelperFactory)
        {
            this.RecordCopierFactory  = recordCopierFactory;
            this._outputHelperFactory = outputHelperFactory;

            var type = this.GetType();

            this._inputs  = type.GetProperties <IIncomingConnectionInterface>();
            this._outputs = type.GetProperties <IOutputHelper>();

            if (this._outputHelperFactory == null && this._outputs.Count > 0)
            {
                throw new ArgumentNullException(
                          nameof(outputHelperFactory),
                          "Tool has an output but no factory has been provided.");
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="CircuitBreakerEngine" /> class.
        ///     Create An Engine for unit testing.
        /// </summary>
        /// <param name="recordCopierFactory">Factory to create copiers</param>
        /// <param name="inputPropertyFactory">Factory to create input properties</param>
        /// <param name="outputHelperFactory">Factory to create output helpers</param>
        internal CircuitBreakerEngine(
            IRecordCopierFactory recordCopierFactory,
            IInputPropertyFactory inputPropertyFactory,
            IOutputHelperFactory outputHelperFactory)
            : base(recordCopierFactory, outputHelperFactory)
        {
            // Handle Breaker Connection
            this.Breaker               = inputPropertyFactory.Build(recordCopierFactory, this.ShowDebugMessages);
            this.Breaker.InitCalled   += (property, args) => this._failed = false;
            this.Breaker.RecordPushed += this.BreakerOnRecordPushed;
            this.Breaker.Closed       += this.BreakerOnClosed;

            // Handle Input Connection
            this.Input                  = inputPropertyFactory.Build(recordCopierFactory, this.ShowDebugMessages);
            this.Input.InitCalled      += this.InputOnInitCalled;
            this.Input.RecordPushed    += this.InputOnRecordPushed;
            this.Input.ProgressUpdated += (sender, args) => this.Output?.UpdateProgress(
                this._failed ? 1.0 : args.Progress,
                true);
            this.Input.Closed += this.InputOnClosed;
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Create An Engine for unit testing.
 /// </summary>
 /// <param name="outputHelperFactory">Factory to create output helpers</param>
 internal RoslynInputEngine(IOutputHelperFactory outputHelperFactory)
     : base(null, outputHelperFactory)
 {
 }
 /// <summary>
 ///     Initializes a new instance of the <see cref="DateTimeInputEngine" /> class.
 ///     Create An Engine for unit testing.
 /// </summary>
 /// <param name="outputHelperFactory">Factory to create output helpers</param>
 internal DateTimeInputEngine(IOutputHelperFactory outputHelperFactory)
     : base(null, outputHelperFactory)
 {
 }