예제 #1
0
        /// <summary>
        /// Configures a table cell.
        /// </summary>
        /// <typeparam name="TVal"></typeparam>
        /// <param name="expression">Cell property expression</param>
        /// <returns>Cell builder</returns>
        public MvcCoreBootstrapTableCellBuilder Cell <TVal>(Expression <Func <TVal> > expression)
        {
            string     cellProperty = ((MemberExpression)expression.Body).Member.Name;
            CellConfig cellConfig   = new CellConfig();

            _configs.Add(cellProperty, cellConfig);

            return(_builderFactory.CellBuilder(cellConfig));
        }
예제 #2
0
        public void Cell()
        {
            CellBuilder configBuilder = new CellBuilder(null);
            CellConfig  config        = null;
            TableEntity entity        = new TableEntity();

            _builderFactory.CellBuilder(Arg.Do <CellConfig>(c => config = c)).Returns(configBuilder);

            CellBuilder builder = _builder.Cell(() => entity.Property);

            _builderFactory.Received(1).CellBuilder(Arg.Any <CellConfig>());
            _configs.Should().HaveCount(1);
            _configs.Should().ContainKey("Property");
            CellConfig cellConfig = _configs["Property"];

            cellConfig.Should().BeSameAs(config);
            cellConfig.CssClasses.Should().BeEmpty();
            cellConfig.State.Should().Be(ContextualState.Default);
            builder.Should().BeSameAs(configBuilder);
        }