public void Setup()
        {
            var context     = new MvcTestContext();
            var viewContext = context.GetViewTestContext <TestViewModel>();

            _h = viewContext.HtmlHelper;
        }
示例#2
0
        public void Setup()
        {
            var context = new MvcTestContext();
            var fg      = new TestFieldGenerator <TestFieldViewModel, T>(context);

            _handler = GetHandler(fg);
        }
示例#3
0
        public TestFieldGenerator(MvcTestContext context)
        {
            var viewContext = context.GetViewTestContext <TModel>();

            HtmlHelper    = viewContext.HtmlHelper;
            FieldProperty = null;
            Template      = new DefaultFormTemplate();
            Metadata      = new EmptyModelMetadataProvider().GetMetadataForType(typeof(T));
        }
        public void Setup()
        {
            var testContext     = new MvcTestContext();
            var testViewContext = testContext.GetViewTestContext <TestFieldViewModel>();

            H = testViewContext.HtmlHelper;
            ExampleFieldConfiguration = new FieldConfiguration().Attr("data-attr", "value");

            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
        }
示例#5
0
        public void Setup()
        {
            _context = new MvcTestContext();
            var viewContext = _context.GetViewTestContext <TestFieldViewModel>();

            _h = viewContext.HtmlHelper;

            _t = Substitute.For <IFormTemplate>();
            _t.BeginForm(Action, Method, _htmlAttributes, Enctype).Returns(_beginHtml);
            _t.EndForm().Returns(_endHtml);
        }
 public MoviesController(MvcTestContext context)
 {
     _context = context;
 }