public void Render_should_ensure_required()
        {
            ViewComponentBaseTestDouble component = new ViewComponentBaseTestDouble(_viewContext, _clientSideObjectWriterFactory.Object) { Name = "dummyComponent" };

            component.Render();

            Assert.True(component.HasEnsuredRequired);
        }
        public void Render_should_write_html()
        {
            ViewComponentBaseTestDouble component = new ViewComponentBaseTestDouble(_viewContext, _clientSideObjectWriterFactory.Object) { Name = "dummyComponent" };

            component.Render();

            Assert.True(component.HasWrittenHtml);
        }
        public void EnsureRequired_should_not_throw_exception_when_internal_name_is_not_blank()
        {
            ViewComponentBaseTestDouble component = new ViewComponentBaseTestDouble(_viewContext, _clientSideObjectWriterFactory.Object)
            {
                Name = "dummyComponent"
            };

            Assert.DoesNotThrow(component.CheckRequired);
        }
        public void Render_should_write_html()
        {
            ViewComponentBaseTestDouble component = new ViewComponentBaseTestDouble(_viewContext, _clientSideObjectWriterFactory.Object)
            {
                Name = "dummyComponent"
            };

            component.Render();

            Assert.True(component.HasWrittenHtml);
        }
        public void Render_should_ensure_required()
        {
            ViewComponentBaseTestDouble component = new ViewComponentBaseTestDouble(_viewContext, _clientSideObjectWriterFactory.Object)
            {
                Name = "dummyComponent"
            };

            component.Render();

            Assert.True(component.HasEnsuredRequired);
        }
        public void EnsureRequired_should_throw_exception_when_internal_name_is_blank()
        {
            ViewComponentBaseTestDouble component = new ViewComponentBaseTestDouble(_viewContext, _clientSideObjectWriterFactory.Object);

            Assert.Throws<InvalidOperationException>(() => component.CheckRequired());
        }
        public void EnsureRequired_should_not_throw_exception_when_internal_name_is_not_blank()
        {
            ViewComponentBaseTestDouble component = new ViewComponentBaseTestDouble(_viewContext, _clientSideObjectWriterFactory.Object) { Name = "dummyComponent" };

            Assert.DoesNotThrow(component.CheckRequired);
        }
        public void WriteInitializationScript_should_do_nothing()
        {
            ViewComponentBaseTestDouble component = new ViewComponentBaseTestDouble(_viewContext, _clientSideObjectWriterFactory.Object);

            component.InitializationScript(new Mock<TextWriter>().Object);
        }
        public void ToComponent_should_return_internal_component()
        {
            ViewComponentBaseTestDouble component = _builder.ToComponent();

            Assert.Same(_component.Object, component);
        }
        public void WriteInitializationScript_should_do_nothing()
        {
            ViewComponentBaseTestDouble component = new ViewComponentBaseTestDouble(_viewContext, _clientSideObjectWriterFactory.Object);

            component.InitializationScript(new Mock <TextWriter>().Object);
        }
        public void EnsureRequired_should_throw_exception_when_internal_name_is_blank()
        {
            ViewComponentBaseTestDouble component = new ViewComponentBaseTestDouble(_viewContext, _clientSideObjectWriterFactory.Object);

            Assert.Throws <InvalidOperationException>(() => component.CheckRequired());
        }