Пример #1
0
        public void RaiseEmployeeSelectedShouldRaiseEmployeeSelected()
        {
            int  employeeId             = 10;
            bool employeeSelectedRaised = false;

            BusinessEntities.Employee selectedEmployee = null;
            BusinessEntities.Employee employee         = new BusinessEntities.Employee(employeeId)
            {
                LastName = "Con", FirstName = "Aaron"
            };
            EmployeesListPresenter presenter = CreatePresenter();

            presenter.EmployeeSelected += delegate(object sender, DataEventArgs <BusinessEntities.Employee> e)
            {
                employeeSelectedRaised = true;
                selectedEmployee       = e.Value;
            };

            Assert.IsFalse(employeeSelectedRaised);
            view.RaiseEmployeeSelected(employee);
            Assert.IsTrue(employeeSelectedRaised);
            Assert.AreEqual("Con", selectedEmployee.LastName);
            Assert.AreEqual("Aaron", selectedEmployee.FirstName);
            Assert.AreEqual(employeeId, selectedEmployee.EmployeeId);
        }
Пример #2
0
        public void RaiseEmployeeSelectedShouldRaiseEmployeeSelected()
        {
            int  employeeId             = 10;
            bool employeeSelectedRaised = false;

            BusinessEntities.Employee selectedEmployee = null;
            BusinessEntities.Employee employee         = new BusinessEntities.Employee(employeeId)
            {
                LastName = "Con", FirstName = "Aaron"
            };
            EmployeesListPresenter presenter = CreatePresenter();

            presenter.View.ObservableRegionContext.PropertyChanged += delegate
            {
                employeeSelectedRaised = true;
            };

            Assert.IsFalse(employeeSelectedRaised);
            view.RaiseEmployeeSelected(employee);

            selectedEmployee = view.ObservableRegionContext.Value as BusinessEntities.Employee;
            Assert.IsTrue(employeeSelectedRaised);
            Assert.AreEqual("Con", selectedEmployee.LastName);
            Assert.AreEqual("Aaron", selectedEmployee.FirstName);
            Assert.AreEqual(employeeId, selectedEmployee.EmployeeId);
        }