Ejemplo n.º 1
0
        public void Update(bool urlSet)
        {
            UpdateBuilder updateBuilder        = new UpdateBuilder(new UpdateConfig());
            UpdateBuilder actionBuilder        = null;
            UpdateConfig  config               = null;
            Exception     exception            = null;
            TableBuilder <TableEntity> builder = null;

            _builderFactory.UpdateBuilder(Arg.Do <UpdateConfig>(c => { config = c; c.Url = urlSet ? "" : null; }))
            .Returns(updateBuilder);

            try
            {
                builder = _builder.Update(b => actionBuilder = b);
                this.RenderAndVerify();
            }
            catch (Exception e)
            {
                exception = e;
            }

            _builderFactory.Received(1).UpdateBuilder(Arg.Any <UpdateConfig>());
            actionBuilder.Should().BeSameAs(updateBuilder);
            if (urlSet)
            {
                exception.Should().BeNull();
                config.Should().BeSameAs(_config.Update);
                builder.Should().BeSameAs(_builder);
            }
            else
            {
                exception.Should().BeOfType <ArgumentNullException>();
            }
        }
        /// <summary>
        /// Configures table updating.
        /// </summary>
        /// <param name="configAction">Configuration action</param>
        /// <returns>The table builder instance.</returns>
        public MvcCoreBootstrapTableBuilder <T> Update(Action <MvcCoreBootstrapTableUpdateBuilder> configAction)
        {
            configAction(_builderFactory.UpdateBuilder(_config.Update));
            if (_config.Update.Url == null)
            {
                throw new ArgumentNullException("Update url");
            }

            return(this);
        }