public void SelectionTest() { IEntityService entityService = Container.GetExportedValue <IEntityService>(); entityService.Persons.Add(new Person() { Firstname = "Harry" }); entityService.Persons.Add(new Person() { Firstname = "Ron" }); PersonController personController = Container.GetExportedValue <PersonController>(); personController.Initialize(); // Check that Initialize shows the PersonListView and PersonView ShellService shellService = Container.GetExportedValue <ShellService>(); Assert.IsInstanceOfType(shellService.PersonListView, typeof(IPersonListView)); Assert.IsInstanceOfType(shellService.PersonView, typeof(IPersonView)); // Check that the first Person is selected IPersonListView personListView = Container.GetExportedValue <IPersonListView>(); PersonListViewModel personListViewModel = ViewHelper.GetViewModel <PersonListViewModel>(personListView); Assert.AreEqual(entityService.Persons.First(), personListViewModel.SelectedPerson); // Change the selection PersonViewModel personViewModel = Container.GetExportedValue <PersonViewModel>(); personListViewModel.SelectedPerson = entityService.Persons.Last(); Assert.AreEqual(entityService.Persons.Last(), personViewModel.Person); }
public void Associate(IPersonListView view) { if (view == null) { throw new ArgumentNullException("view"); } View = view; }
public PersonListPresenter(IPersonListView View, IPersonManager Manager) { _view = View; _manager = Manager; _view.Presenter = this; RegisterViewEvents(); _view.ShowView(); }
public PersonListPresenter(IPersonListView viewToUse, IPersonRepository personRepositoryToUse, ICompanyRepository companyRepositoryToUse) { this.view = viewToUse; this.personRepository = personRepositoryToUse; this.companyRepository = companyRepositoryToUse; }
public PersonListPresenter(IPersonListView viewToUse) { this.view = viewToUse; this.personRepository = new PersonRepository(); this.companyRepository = new CompanyRepository(); }
public void TestCleanup() { this.view = null; }
public void TestInitialize() { this.view = new MockPersonListView(); }