public void CanLoadOpenIncidentTasks() { SharePointServiceLocator.ReplaceCurrentServiceLocator(new ActivatingServiceLocator() .RegisterTypeMapping <IPartnerSiteDirectory, MockPartnerSiteDirectory>() .RegisterTypeMapping <IIncidentTaskRepository, MockIncidentTaskRepository>()); MockPartnerRollupView view = new MockPartnerRollupView(); var target = new PartnerRollupPresenter(view); target.ReturnSearchResults(); Assert.AreEqual(2, view.Data.Count()); Assert.AreEqual("1", view.Data.First().Partner.PartnerId); Assert.AreEqual(1, view.Data.First().IncidentTasks.Count); Assert.AreEqual("1", view.Data.First().IncidentTasks.First().AssignedTo); }
protected override void CreateChildControls() { base.CreateChildControls(); ErrorVisualizer errorVisualizer = new ErrorVisualizer(); this.Controls.Add(errorVisualizer); // Create the View and also create the presetner and associate them together. PartnerRollupControl control = (PartnerRollupControl)Page.LoadControl("~/_controltemplates/Contoso/PartnerRollupControl.ascx"); errorVisualizer.Controls.Add(control); presenter = new PartnerRollupPresenter(control); // In this variation of the MVP pattern, the Webpart can talk directly to the presenter. presenter.ReturnSearchResults(); }