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);
        }
Example #2
0
 public void Associate(IPersonListView view)
 {
     if (view == null) {
         throw new ArgumentNullException("view");
     }
     View = view;
 }
 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 View, IPersonManager Manager)
        {
            _view = View;
            _manager = Manager;

            _view.Presenter = this;
            RegisterViewEvents();
            _view.ShowView();
        }
Example #6
0
 public PersonListPresenter(IPersonListView viewToUse, IPersonRepository personRepositoryToUse, ICompanyRepository companyRepositoryToUse)
 {
     this.view              = viewToUse;
     this.personRepository  = personRepositoryToUse;
     this.companyRepository = companyRepositoryToUse;
 }
Example #7
0
 public PersonListPresenter(IPersonListView viewToUse)
 {
     this.view              = viewToUse;
     this.personRepository  = new PersonRepository();
     this.companyRepository = new CompanyRepository();
 }
Example #8
0
 public void TestCleanup()
 {
     this.view = null;
 }
Example #9
0
 public void TestInitialize()
 {
     this.view = new MockPersonListView();
 }