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); }
public void SetUp() { _builder = MockRepository.GenerateMock <IWebFormsControlBuilder>(); _request = new InMemoryFubuRequest(); _builder.Stub(b => b.LoadControlFromVirtualPath(null, null)) .IgnoreArguments() .Return(new TestControl()); _executeCatcher = _builder.CaptureArgumentsFor(b => b.ExecuteControl(null, null)); _parentView = new TestView(); _renderer = new PartialRenderer(_builder); }
public void should_execute_the_control_rendering_when_rendering() { _builder.Stub(b => b.LoadControlFromVirtualPath(null, null)) .IgnoreArguments() .Return(new TestControl()); _builder.Expect(b => b.ExecuteControl(null, null)).IgnoreArguments(); _request.Set(new TestViewModel()); new PartialRenderer(_builder, new StubActivator(), new InMemoryFubuRequest()) .Render(new TestView(), typeof(TestControl), new TestControlViewModel(), ""); _builder.VerifyAllExpectations(); }