public SelectCommandTests()
 {
     sqlBuilder  = new SqlBuilder();
     sqlExecutor = new Mock <ISqlExecutorWithGeneric>();
     command     = new SelectCommand(
         sqlBuilder: sqlBuilder,
         sqlExecutor: sqlExecutor.Object);
 }
Exemple #2
0
 private DataBase(
     ISelectCommand selectCommand,
     IInsertCommand insertCommand,
     IDeleteCommand deleteCommand,
     IUpdateCommand updateCommand,
     ISqlExecutorWithGeneric sqlExecutor)
 {
     this.selectCommand = selectCommand;
     this.insertCommand = insertCommand;
     this.deleteCommand = deleteCommand;
     this.updateCommand = updateCommand;
     this.sqlExecutor   = sqlExecutor;
 }
 public ScatterPlotViewModelCommands(
     IResizeScatterPlotViewExtentCommand resizeCommand,
     IZoomInScatterPlotCommand zoomInCommand,
     IZoomOutScatterPlotCommand zoomOutCommand,
     IPanScatterPlotCommand panCommand,
     ISelectCommand selectCommand,
     ICommandBus commandBus)
 {
     _resizeCommand  = resizeCommand;
     _zoomInCommand  = zoomInCommand;
     _zoomOutCommand = zoomOutCommand;
     _panCommand     = panCommand;
     _selectCommand  = selectCommand;
     _commandBus     = commandBus;
 }
        public static Dictionary <string, object> ToParameters(this ISelectCommand select, Domain domain, IEnumerable <IDevice> devices)
        {
            var value = select.Value?.ToString() ?? throw new ArgumentNullException(nameof(select.Value), "The selected value cannot be 'null'");

            switch (domain)
            {
            case Domain.InputSelect:
                return(new Dictionary <string, object>
                {
                    { "option", value }
                }
                       .Add(devices));

            default:
                throw new NotSupportedException($"Domain '{domain}' does not support command Select, but one or more device tries to use it ({devices.Select(d => d.Id.ToString()).JoinBy(", ")})");
            }
        }
Exemple #5
0
 protected IEnumerable <TestEntity> AssumeResultsFromIsRequested(ISelectCommand <TestEntity> query)
 {
     return(repository.ResultsFrom(query));
 }
Exemple #6
0
 /// <summary>
 /// Add Top Command
 /// </summary>
 /// <param name="selectCommand">Select Command instance</param>
 /// <param name="size">Size of records</param>
 /// <returns></returns>
 public static ITopCommand Top(this ISelectCommand selectCommand, int size = 1)
 => selectCommand.To((s, p) => new TopCommand(s, p, size));
Exemple #7
0
 /// <summary>
 /// Add From to query
 /// </summary>
 /// <param name="selectCommand">Select Command Instance</param>
 /// <param name="table">Table name</param>
 /// <returns></returns>
 public static IFromCommand From(this ISelectCommand selectCommand, string table)
 => selectCommand.To((s, p) => new FromCommand(s, p, table));
 /// <summary>
 /// Add From to query
 /// </summary>
 /// <param name="selectCommand">Select Command Extension</param>
 /// <param name="schema">Schema name</param>
 /// <param name="table">Table name</param>
 /// <returns></returns>
 public static IFromCommand From(this ISelectCommand selectCommand, string schema, string table)
 => selectCommand is IFromCommand command?command.FromCommand(schema, table) : null;
Exemple #9
0
 public IEnumerable <TEntity> ResultsFrom(ISelectCommand <TEntity> query)
 {
     return(query.Go());
 }