Beispiel #1
0
 internal TableBuilder(TableModel <T> model, ITableRenderer <T> renderer, IBuilderFactory builderFactory,
                       ITableConfig <T> config)
 {
     _model          = model;
     _renderer       = renderer;
     _builderFactory = builderFactory;
     _config         = config;
 }
        public TableBuilderTest()
        {
            TableModel <TableEntity> model = new TableModel <TableEntity>(Enumerable.Empty <TableEntity>());

            _renderer = Substitute.For <ITableRenderer <TableEntity> >();
            _renderer.Render(Arg.Do <ITableConfig <TableEntity> >(tc => _config = tc), Arg.Any <int>());
            _builderFactory = Substitute.For <IBuilderFactory>();
            _tableConfig    = Substitute.For <ITableConfig <TableEntity> >();
            _tableConfig.Paging.Returns(new PagingConfig());
            _tableConfig.Update.Returns(new UpdateConfig());
            _tableConfig.Columns.Returns(new Dictionary <string, ColumnConfig>());
            _builder = new TableBuilder <TableEntity>(model, _renderer, _builderFactory, _tableConfig);
        }
Beispiel #3
0
        /// <summary>
        /// Adds a table to the card.
        /// </summary>
        /// <param name="configAction">Action to perform table configuration.</param>
        /// <returns>The card builder instance.</returns>
        public MvcCoreBootstrapCardBuilder Table <T>(TableModel <T> model, Action <MvcCoreBootstrapTableBuilder <T> > configAction) where T : new()
        {
            TableState tableState = new TableStateParser().Parse(_httpContext);

            _tableEntities = model.ProcessedEntities as IEnumerable <object>;
            _tableConfig   = new TableConfig();
            _tableRenderer = new TableRenderer <T>(model, _tableConfig, tableState, new TableNodeParser());
            configAction(new MvcCoreBootstrapTableBuilder <T>(model, new BuilderFactory(), _tableConfig));

            _tableConfigHandler.Check(_tableConfig, _tableEntities);
            _tableConfig.ContainerId = _config.Id;

            return(this);
        }
Beispiel #4
0
        public IHtmlContent Render(CardConfig config, ITableRenderer tableRenderer, IListGroupRenderer listGroupRenderer)
        {
            Element = new TagBuilder("div");
            this.BaseConfig(config, "card", "bg-");
            this.AddElement(new TagBuilder("div"), new[] { "card-header" }, config.Header);
            this.Body(config);
            if (tableRenderer != null)
            {
                Element.InnerHtml.AppendHtml(tableRenderer.Render());
            }
            if (listGroupRenderer != null)
            {
                Element.InnerHtml.AppendHtml(listGroupRenderer.Render());
            }
            this.AddElement(new TagBuilder("div"), new[] { "card-footer" }, config.Footer);

            return(Element);
        }
Beispiel #5
0
        /// <summary>
        /// This is for testing only. The assumption is that players and deelers are created through table object.
        /// </summary>
        /// <param name="deckOfCards"></param>
        /// <param name="table"></param>
        /// <param name="tableRenderer"></param>
        public GameManager(
            IDeck deckOfCards,
            ITable table,
            ITableRenderer tableRenderer,
            IInputProvider inputProvider,
            IOutputProvider outputProvider,
            IMove moveProvider
            )
        {
            this.table   = table;
            this.players = table.Players != null?table.Players.ToList() : null;

            this.dealer         = table.Dealer != null ? table.Dealer : null;
            this.tableRenderer  = tableRenderer;
            this.deck           = deckOfCards;
            this.inputProvider  = inputProvider;
            this.outputProvider = outputProvider;
            this.moveProvider   = moveProvider;
        }