Пример #1
0
 protected override void beforeEach()
 {
     _viewModel = new TestControlViewModel();
     _request   = new InMemoryFubuRequest();
     _request.Set(_viewModel);
     Services.Inject <IFubuRequest>(_request);
 }
Пример #2
0
        public void should_set_the_model_in_the_FubuRequest()
        {
            var viewModel = new TestControlViewModel();

            ClassUnderTest.Render(new TestControl(), viewModel, "", new StringWriter());

            MockFor <IFubuRequest>().AssertWasCalled(r => r.Set(viewModel.GetType(), viewModel));
        }
Пример #3
0
        public void should_set_the_view_model_when_rendering()
        {
            var userControl = new TestControl();

            _builder.Stub(b => b.LoadControlFromVirtualPath(null, null))
            .IgnoreArguments()
            .Return(userControl);

            var          model  = new TestControlViewModel(); // LogViewModel<NotesLog> { Log = new NotesLog { Notes = "model" } };
            const string prefix = "prefix";

            new PartialRenderer(_builder).Render(new TestView(), typeof(TestControl), model, prefix);

            userControl.Model.ShouldBeTheSameAs(model);
            ((IFubuPage)userControl).ElementPrefix.ShouldEqual(prefix);
        }