/// <summary>
        /// Initializes a new instance of the DepartmentViewModel class.
        /// </summary>
        /// <param name="department">The underlying Department this ViewModel is to be based on</param>
        public DepartmentViewModel(Department department)
        {
            if (department == null)
            {
                throw new ArgumentNullException("department");
            }

            this.Model = department;
        }
        public void ModelChangesFlowToProperties()
        {
            // 测试 ViewModel 返回模型的当前值
            Department dep = new Department { DepartmentName = "DepartmentName", DepartmentCode = "DepartmentCode" };
            DepartmentViewModel vm = new DepartmentViewModel(dep);

            vm.DepartmentName = "DepartmentName_NEW";
            Assert.AreEqual("DepartmentName_NEW", dep.DepartmentName, "DepartmentName property is not fetching the value from the model.");
            vm.DepartmentCode = "DepartmentCode_NEW";
            Assert.AreEqual("DepartmentCode_NEW", dep.DepartmentCode, "DepartmentCode property is not fetching the value from the model.");
        }
        public void InitializationWithSuppliedCollections()
        {
            Department dep = new Department();
            ContactDetail det = new Phone();
            Employee emp = new Employee { ContactDetails = new List<ContactDetail> { det } };

            using (FakeEmployeeContext ctx = new FakeEmployeeContext(new Employee[] { emp }, new Department[] { dep }))
            {
                Assert.IsTrue(ctx.Employees.Contains(emp), "Constructor did not add supplied Employees to public ObjectSet.");
                Assert.IsTrue(ctx.Departments.Contains(dep), "Constructor did not add supplied Departments to public ObjectSet.");
                Assert.IsTrue(ctx.ContactDetails.Contains(det), "Constructor did not add supplied ContactDetails to public ObjectSet.");
            }
        }
示例#4
0
        public void IsObjectTracked()
        {
            using (EmployeeEntities ctx = new EmployeeEntities())
            {
                Employee e = new Employee();
                Assert.IsFalse(ctx.IsObjectTracked(e), "IsObjectTracked should be false when entity is not in added.");
                ctx.Employees.AddObject(e);
                Assert.IsTrue(ctx.IsObjectTracked(e), "IsObjectTracked should be true when entity is added.");

                Department d = new Department();
                Assert.IsFalse(ctx.IsObjectTracked(d), "IsObjectTracked should be false when entity is not in added.");
                ctx.Departments.AddObject(d);
                Assert.IsTrue(ctx.IsObjectTracked(d), "IsObjectTracked should be true when entity is added.");

                ContactDetail c = new Phone();
                Assert.IsFalse(ctx.IsObjectTracked(c), "IsObjectTracked should be false when entity is not in added.");
                ctx.ContactDetails.AddObject(c);
                Assert.IsTrue(ctx.IsObjectTracked(c), "IsObjectTracked should be true when entity is added.");
            }
        }
        public void PropertyGetAndSet()
        {
            // 测试初始属性显示在 ViewModel 中
            Department dep = new Department { DepartmentName = "DepartmentName", DepartmentCode = "DepartmentCode" };
            DepartmentViewModel vm = new DepartmentViewModel(dep);
            Assert.AreEqual(dep, vm.Model, "Bound object property did not return object from model.");
            Assert.AreEqual("DepartmentName", vm.DepartmentName, "DepartmentName property did not return value from model.");
            Assert.AreEqual("DepartmentCode", vm.DepartmentCode, "DepartmentCode property did not return value from model.");

            // 更改属性的测试将更新模型并引发 PropertyChanged
            string lastProperty;
            vm.PropertyChanged += (sender, e) => { lastProperty = e.PropertyName; };

            lastProperty = null;
            vm.DepartmentName = "DepartmentName_NEW";
            Assert.AreEqual("DepartmentName", lastProperty, "Setting DepartmentName property did not raise correct PropertyChanged event.");
            Assert.AreEqual("DepartmentName_NEW", dep.DepartmentName, "Setting DepartmentName property did not update model.");

            lastProperty = null;
            vm.DepartmentCode = "DepartmentCode_NEW";
            Assert.AreEqual("DepartmentCode", lastProperty, "Setting DepartmentName property did not raise correct PropertyChanged event.");
            Assert.AreEqual("DepartmentCode_NEW", dep.DepartmentCode, "Setting DepartmentCode property did not update model.");
        }
        public void PropertyGetAndSet()
        {
            // Test initial properties are surfaced in ViewModel
            Department dep = new Department { DepartmentName = "DepartmentName", DepartmentCode = "DepartmentCode" };
            DepartmentViewModel vm = new DepartmentViewModel(dep);
            Assert.AreEqual(dep, vm.Model, "Bound object property did not return object from model.");
            Assert.AreEqual("DepartmentName", vm.DepartmentName, "DepartmentName property did not return value from model.");
            Assert.AreEqual("DepartmentCode", vm.DepartmentCode, "DepartmentCode property did not return value from model.");

            // Test changing properties updates Model and raises PropertyChanged
            string lastProperty;
            vm.PropertyChanged += (sender, e) => { lastProperty = e.PropertyName; };

            lastProperty = null;
            vm.DepartmentName = "DepartmentName_NEW";
            Assert.AreEqual("DepartmentName", lastProperty, "Setting DepartmentName property did not raise correct PropertyChanged event.");
            Assert.AreEqual("DepartmentName_NEW", dep.DepartmentName, "Setting DepartmentName property did not update model.");

            lastProperty = null;
            vm.DepartmentCode = "DepartmentCode_NEW";
            Assert.AreEqual("DepartmentCode", lastProperty, "Setting DepartmentName property did not raise correct PropertyChanged event.");
            Assert.AreEqual("DepartmentCode_NEW", dep.DepartmentCode, "Setting DepartmentCode property did not update model.");
        }
        public void GetAllDepartments()
        {
            Department d1 = new Department();
            Department d2 = new Department();
            Department d3 = new Department();

            using (FakeEmployeeContext ctx = new FakeEmployeeContext(new Employee[] { }, new Department[] { d1, d2, d3 }))
            {
                DepartmentRepository rep = new DepartmentRepository(ctx);

                IEnumerable<Department> result = rep.GetAllDepartments();

                Assert.IsNotInstanceOfType(
                    result,
                    typeof(IQueryable),
                    "Repositories should not return IQueryable as this allows modification of the query that gets sent to the store. ");

                Assert.AreEqual(3, result.Count());
                Assert.IsTrue(result.Contains(d1));
                Assert.IsTrue(result.Contains(d2));
                Assert.IsTrue(result.Contains(d3));
            }
        }
示例#8
0
        public void AddDepartment()
        {
            using (FakeEmployeeContext ctx = new FakeEmployeeContext())
            {
                UnitOfWork unit = new UnitOfWork(ctx);

                Department dep = new Department();
                unit.AddDepartment(dep);
                Assert.IsTrue(ctx.Departments.Contains(dep), "Department was not added to underlying context.");
            }
        }
示例#9
0
        public void RemoveDepartmentWithEmployees()
        {
            using (FakeEmployeeContext ctx = new FakeEmployeeContext())
            {
                UnitOfWork unit = new UnitOfWork(ctx);
                Department dep = new Department();
                Employee emp = new Employee();
                unit.AddDepartment(dep);
                unit.AddEmployee(emp);
                emp.Department = dep;

                unit.RemoveDepartment(dep);
                Assert.IsFalse(ctx.Departments.Contains(dep), "Department was not removed from underlying context.");
                Assert.IsNull(emp.Department, "Employee.Department property has not been nulled when deleting department.");
                Assert.IsNull(emp.DepartmentId, "Employee.DepartmentId property has not been nulled when deleting department.");
                Assert.AreEqual(0, dep.Employees.Count, "Department.Employees collection was not cleared when deleting department.");
            }
        }
示例#10
0
        public void RemoveDepartment()
        {
            using (FakeEmployeeContext ctx = new FakeEmployeeContext())
            {
                UnitOfWork unit = new UnitOfWork(ctx);
                Department dep = new Department();
                unit.AddDepartment(dep);

                unit.RemoveDepartment(dep);
                Assert.IsFalse(ctx.Departments.Contains(dep), "Department was not removed from underlying context.");
            }
        }
示例#11
0
        public void AddDepartmentAlreadyInUnitOfWork()
        {
            using (FakeEmployeeContext ctx = new FakeEmployeeContext())
            {
                UnitOfWork unit = new UnitOfWork(ctx);

                Department dep = new Department();
                unit.AddDepartment(dep);

                try
                {
                    unit.AddDepartment(dep);
                    Assert.Fail("Adding an Department that was already added did not throw.");
                }
                catch (InvalidOperationException ex)
                {
                    Assert.AreEqual("The supplied Department is already part of this Unit of Work.", ex.Message);
                }
            }
        }
        /// <summary>
        /// 生成一个包含设为种子的数据的虚设上下文
        /// </summary>
        /// <returns>已填充的上下文</returns>
        private static FakeEmployeeContext BuildContextWithData()
        {
            Department d1 = new Department();
            Department d2 = new Department();

            DepartmentViewModel dvm1 = new DepartmentViewModel(d1);
            DepartmentViewModel dvm2 = new DepartmentViewModel(d2);

            return new FakeEmployeeContext(new Employee[] { }, new Department[] { d1, d2 });
        }
        /// <summary>
        /// Creates a fake context with seed data
        /// </summary>
        /// <returns>The fake context</returns>
        private static FakeEmployeeContext BuildContextWithData()
        {
            Department d1 = new Department();
            Department d2 = new Department();

            Employee e1 = new Employee { Department = d1 };
            Employee e2 = new Employee { Department = d1 };

            e1.Manager = e2;

            e1.ContactDetails.Add(new Phone());
            e1.ContactDetails.Add(new Email());
            e1.ContactDetails.Add(new Address());
            e2.ContactDetails.Add(new Phone());

            return new FakeEmployeeContext(new Employee[] { e1, e2 }, new Department[] { d1, d2 });
        }
        public void InitializeWithData()
        {
            Employee e1 = new Employee();
            Employee e2 = new Employee();

            Department d1 = new Department();
            Department d2 = new Department();

            using (FakeEmployeeContext ctx = new FakeEmployeeContext(new Employee[] { e1, e2 }, new Department[] { d1, d2 }))
            {
                UnitOfWork unit = new UnitOfWork(ctx);
                ObservableCollection<DepartmentViewModel> departments = new ObservableCollection<DepartmentViewModel>(ctx.Departments.Select(d => new DepartmentViewModel(d)));
                ObservableCollection<EmployeeViewModel> employees = new ObservableCollection<EmployeeViewModel>();
                foreach (var e in ctx.Employees)
                {
                    employees.Add(new EmployeeViewModel(e, employees, departments, unit));
                }

                EmployeeWorkspaceViewModel vm = new EmployeeWorkspaceViewModel(employees, departments, unit);

                Assert.IsNotNull(vm.CurrentEmployee, "Current employee should be set if there are departments.");
                Assert.AreSame(employees, vm.AllEmployees, "ViewModel should expose the same instance of the Employee collection so that changes outside the ViewModel are reflected.");
                Assert.AreSame(employees, vm.AllEmployees[0].ManagerLookup, "ViewModel should expose the same instance of the Employee collection to children so that changes outside the ViewModel are reflected.");
                Assert.AreSame(departments, vm.AllEmployees[0].DepartmentLookup, "ViewModel should expose the same instance of the Department collection to children so that changes outside the ViewModel are reflected.");
            }
        }
示例#15
0
        public void ReferencesGetAndSet()
        {
            // Scalar 属性继承自 BasicEmployeeViewModel 并且已经测试
            Department d1 = new Department();
            Department d2 = new Department();

            Employee e1 = new Employee();
            Employee e2 = new Employee();
            Employee employee = new Employee { Department = d1, Manager = e1 };
            employee.ContactDetails.Add(new Phone());
            employee.ContactDetails.Add(new Email());

            using (FakeEmployeeContext ctx = new FakeEmployeeContext(new Employee[] { e1, e2, employee }, new Department[] { d1, d2 }))
            {
                UnitOfWork unit = new UnitOfWork(ctx);

                DepartmentViewModel dvm1 = new DepartmentViewModel(d1);
                DepartmentViewModel dvm2 = new DepartmentViewModel(d2);
                ObservableCollection<DepartmentViewModel> departments = new ObservableCollection<DepartmentViewModel> { dvm1, dvm2 };

                ObservableCollection<EmployeeViewModel> employees = new ObservableCollection<EmployeeViewModel>();
                EmployeeViewModel evm1 = new EmployeeViewModel(e1, employees, departments, unit);
                EmployeeViewModel evm2 = new EmployeeViewModel(e2, employees, departments, unit);
                EmployeeViewModel employeeViewModel = new EmployeeViewModel(employee, employees, departments, unit);
                employees.Add(evm1);
                employees.Add(evm2);
                employees.Add(employeeViewModel);

                // 测试初始引用显示在 ViewModel 中
                Assert.AreEqual(evm1, employeeViewModel.Manager, "ViewModel did not return ViewModel representing current manager.");
                Assert.AreEqual(e1, employeeViewModel.Manager.Model, "ViewModel did not return ViewModel representing current manager.");
                Assert.AreEqual(dvm1, employeeViewModel.Department, "ViewModel did not return ViewModel representing current department.");
                Assert.AreEqual(d1, employeeViewModel.Department.Model, "ViewModel did not return ViewModel representing current department.");
                Assert.AreEqual(2, employeeViewModel.ContactDetails.Count, "Contact details have not been populated on ViewModel.");

                // 更改属性的测试将更新模型并引发 PropertyChanged
                string lastProperty;
                employeeViewModel.PropertyChanged += (sender, e) => { lastProperty = e.PropertyName; };

                lastProperty = null;
                employeeViewModel.Department = dvm2;
                Assert.AreEqual("Department", lastProperty, "Setting Department property did not raise correct PropertyChanged event.");
                Assert.AreEqual(d2, employee.Department, "Setting Department property in ViewModel is not reflected in Model.");

                lastProperty = null;
                employeeViewModel.Manager = evm2;
                Assert.AreEqual("Manager", lastProperty, "Setting Manager property did not raise correct PropertyChanged event.");
                Assert.AreEqual(e2, employee.Manager, "Setting Manager property in ViewModel is not reflected in Model.");

                // 测试 ViewModel 返回模型的当前值
                employee.Manager = e1;
                Assert.AreEqual(evm1, employeeViewModel.Manager, "ViewModel did not return correct manager when model was updated outside of ViewModel.");
                employee.Department = d1;
                Assert.AreEqual(dvm1, employeeViewModel.Department, "ViewModel did not return correct department when model was updated outside of ViewModel.");

                // 当设置为 null 时,测试 ViewModel 返回模型的当前值
                employee.Manager = null;
                Assert.AreEqual(null, employeeViewModel.Manager, "ViewModel did not return correct manager when model was updated outside of ViewModel.");
                employee.Department = null;
                Assert.AreEqual(null, employeeViewModel.Department, "ViewModel did not return correct department when model was updated outside of ViewModel.");
            }
        }
        public void ReferencesGetAndSet()
        {
            // Scalar properties are inherited from BasicEmployeeViewModel and are already tested
            Department d1 = new Department();
            Department d2 = new Department();

            Employee e1 = new Employee();
            Employee e2 = new Employee();
            Employee employee = new Employee { Department = d1, Manager = e1 };
            employee.ContactDetails.Add(new Phone());
            employee.ContactDetails.Add(new Email());

            using (FakeEmployeeContext ctx = new FakeEmployeeContext(new Employee[] { e1, e2, employee }, new Department[] { d1, d2 }))
            {
                UnitOfWork unit = new UnitOfWork(ctx);

                DepartmentViewModel dvm1 = new DepartmentViewModel(d1);
                DepartmentViewModel dvm2 = new DepartmentViewModel(d2);
                ObservableCollection<DepartmentViewModel> departments = new ObservableCollection<DepartmentViewModel> { dvm1, dvm2 };

                ObservableCollection<EmployeeViewModel> employees = new ObservableCollection<EmployeeViewModel>();
                EmployeeViewModel evm1 = new EmployeeViewModel(e1, employees, departments, unit);
                EmployeeViewModel evm2 = new EmployeeViewModel(e2, employees, departments, unit);
                EmployeeViewModel employeeViewModel = new EmployeeViewModel(employee, employees, departments, unit);
                employees.Add(evm1);
                employees.Add(evm2);
                employees.Add(employeeViewModel);

                // Test initial references are surfaced in ViewModel
                Assert.AreEqual(evm1, employeeViewModel.Manager, "ViewModel did not return ViewModel representing current manager.");
                Assert.AreEqual(e1, employeeViewModel.Manager.Model, "ViewModel did not return ViewModel representing current manager.");
                Assert.AreEqual(dvm1, employeeViewModel.Department, "ViewModel did not return ViewModel representing current department.");
                Assert.AreEqual(d1, employeeViewModel.Department.Model, "ViewModel did not return ViewModel representing current department.");
                Assert.AreEqual(2, employeeViewModel.ContactDetails.Count, "Contact details have not been populated on ViewModel.");

                // Test changing properties updates Model and raises PropertyChanged
                string lastProperty;
                employeeViewModel.PropertyChanged += (sender, e) => { lastProperty = e.PropertyName; };

                lastProperty = null;
                employeeViewModel.Department = dvm2;
                Assert.AreEqual("Department", lastProperty, "Setting Department property did not raise correct PropertyChanged event.");
                Assert.AreEqual(d2, employee.Department, "Setting Department property in ViewModel is not reflected in Model.");

                lastProperty = null;
                employeeViewModel.Manager = evm2;
                Assert.AreEqual("Manager", lastProperty, "Setting Manager property did not raise correct PropertyChanged event.");
                Assert.AreEqual(e2, employee.Manager, "Setting Manager property in ViewModel is not reflected in Model.");

                // Test ViewModel returns current value from model
                employee.Manager = e1;
                Assert.AreEqual(evm1, employeeViewModel.Manager, "ViewModel did not return correct manager when model was updated outside of ViewModel.");
                employee.Department = d1;
                Assert.AreEqual(dvm1, employeeViewModel.Department, "ViewModel did not return correct department when model was updated outside of ViewModel.");

                // Test ViewModel returns current value from model when set to null
                employee.Manager = null;
                Assert.AreEqual(null, employeeViewModel.Manager, "ViewModel did not return correct manager when model was updated outside of ViewModel.");
                employee.Department = null;
                Assert.AreEqual(null, employeeViewModel.Department, "ViewModel did not return correct department when model was updated outside of ViewModel.");
            }
        }
        /// <summary>
        /// Creates a fake context with seed data
        /// </summary>
        /// <returns>The fake context</returns>
        private static FakeEmployeeContext BuildContextWithData()
        {
            Employee e1 = new Employee();
            Employee e2 = new Employee();

            Department d1 = new Department();
            Department d2 = new Department();

            return new FakeEmployeeContext(new Employee[] { e1, e2 }, new Department[] { d1, d2 });
        }
示例#18
0
 /// <summary>
 /// 用于向 Departments EntitySet 添加新对象的方法,已弃用。请考虑改用关联的 ObjectSet&lt;T&gt; 属性的 .Add 方法。
 /// </summary>
 public void AddToDepartments(Department department)
 {
     base.AddObject("Departments", department);
 }
示例#19
0
        /// <summary>
        /// Builds a FakeUnitOfWork with realistic seeded data
        /// </summary>
        /// <returns>Context seeded with data</returns>
        public static FakeEmployeeContext BuildFakeSession()
        {
            Department sales = new Department { DepartmentName = "Sales", DepartmentCode = "SALES", LastAudited = new DateTime(2009, 4, 1) };
            Department corporate = new Department { DepartmentName = "Corporate", DepartmentCode = "CORP" };
            Department purchasing = new Department { DepartmentName = "Purchasing", DepartmentCode = "PURCH" };
            Department marketing = new Department { DepartmentName = "Marketing", DepartmentCode = "MARK", LastAudited = new DateTime(2009, 1, 1) };

            Employee e1 = new Employee { Title = "Mr.", FirstName = "Nancy", LastName = "Davolio", Position = "Sales Representative", HireDate = new DateTime(1992, 5, 1), BirthDate = new DateTime(1948, 12, 8), Department = sales, ContactDetails = new List<ContactDetail>() };
            Employee e2 = new Employee { Title = "Dr.", FirstName = "Andrew", LastName = "Fuller", Position = "Vice President", HireDate = new DateTime(1992, 8, 14), BirthDate = new DateTime(1952, 2, 19), Department = corporate, ContactDetails = new List<ContactDetail>() };
            Employee e3 = new Employee { Title = "Ms.", FirstName = "Janet", LastName = "Leverling", Position = "Sales Representative", HireDate = new DateTime(1992, 4, 1), BirthDate = new DateTime(1963, 8, 30), Department = sales, ContactDetails = new List<ContactDetail>() };
            Employee e4 = new Employee { Title = "Mrs.", FirstName = "Margaret", LastName = "Peacock", Position = "Sales Representative", HireDate = new DateTime(1993, 5, 3), BirthDate = new DateTime(1937, 9, 19), Department = sales, ContactDetails = new List<ContactDetail>() };
            Employee e5 = new Employee { Title = "Mr.", FirstName = "Steven", LastName = "Buchanan", Position = "Sales Manager", HireDate = new DateTime(1993, 10, 17), BirthDate = new DateTime(1955, 3, 4), Department = sales, ContactDetails = new List<ContactDetail>() };
            Employee e6 = new Employee { Title = "Mr.", FirstName = "Michael", LastName = "Suyama", Position = "Sales Representative", HireDate = new DateTime(1993, 10, 17), BirthDate = new DateTime(1963, 7, 2), Department = sales, ContactDetails = new List<ContactDetail>() };
            Employee e7 = new Employee { Title = "Mr.", FirstName = "Robert", LastName = "King", Position = "Sales Representative", HireDate = new DateTime(1994, 1, 2), BirthDate = new DateTime(1960, 5, 29), Department = sales, ContactDetails = new List<ContactDetail>() };
            Employee e8 = new Employee { Title = "Ms.", FirstName = "Callahan", LastName = "Laura", Position = "Inside Sales Coordinator", HireDate = new DateTime(1994, 3, 5), BirthDate = new DateTime(1958, 1, 9), Department = sales, ContactDetails = new List<ContactDetail>() };
            Employee e9 = new Employee { Title = "Ms.", FirstName = "Anne", LastName = "Dodsworth", Position = "Sales Representative", HireDate = new DateTime(1994, 11, 15), BirthDate = new DateTime(1996, 1, 27), Department = sales, ContactDetails = new List<ContactDetail>() };

            e1.ContactDetails.Add(new Address { Usage = "Home", LineOne = "507 - 20th Ave. E.  Apt. 2A", City = "Seattle", State = "WA", ZipCode = "98122", Country = "USA" });
            e2.ContactDetails.Add(new Address { Usage = "Home", LineOne = "908 W. Capital Wa", City = "Tacoma", State = "WA", ZipCode = "98401", Country = "USA" });
            e3.ContactDetails.Add(new Address { Usage = "Business", LineOne = "722 Moss Bay Blvd.", City = "Kirkland", State = "WA", ZipCode = "98033", Country = "USA" });
            e4.ContactDetails.Add(new Address { Usage = "Business", LineOne = "4110 Old Redmond Rd.", City = "Redmond", State = "WA", ZipCode = "98052", Country = "USA" });
            e5.ContactDetails.Add(new Address { Usage = "Business", LineOne = "14 Garrett Hill", City = "London", ZipCode = "SW1 8JR", Country = "UK" });
            e6.ContactDetails.Add(new Address { Usage = "Business", LineOne = "Coventry House  Miner Rd.", City = "London", ZipCode = "EC2 7JR", Country = "UK" });
            e7.ContactDetails.Add(new Address { Usage = "Mailing", LineOne = "Edgeham Hollow  Winchester Way", City = "London", ZipCode = "RG1 9SP", Country = "UK" });
            e8.ContactDetails.Add(new Address { Usage = "Mailing", LineOne = "4726 - 11th Ave. N.E.", City = "Seattle", State = "WA", ZipCode = "98105", Country = "USA" });
            e9.ContactDetails.Add(new Address { Usage = "Mailing", LineOne = "7 Houndstooth Rd.", City = "London", ZipCode = "WG2 7LT", Country = "UK" });

            e1.ContactDetails.Add(new Phone { Usage = "Business", Number = "(206) 555-9857", Extension = "5467" });
            e1.ContactDetails.Add(new Phone { Usage = "Cell", Number = "(71) 555-7773" });
            e2.ContactDetails.Add(new Phone { Usage = "Business", Number = "(206) 555-9482", Extension = "3457" });
            e2.ContactDetails.Add(new Phone { Usage = "Home", Number = "(71) 555-5598" });
            e3.ContactDetails.Add(new Phone { Usage = "Business", Number = "(206) 555-3412", Extension = "3355" });
            e3.ContactDetails.Add(new Phone { Usage = "Home", Number = "(206) 555-1189" });
            e4.ContactDetails.Add(new Phone { Usage = "Business", Number = "(206) 555-8122", Extension = "5176" });
            e4.ContactDetails.Add(new Phone { Usage = "Home", Number = "(71) 555-4444" });
            e5.ContactDetails.Add(new Phone { Usage = "Business", Number = "(71) 555-4848", Extension = "3453" });
            e6.ContactDetails.Add(new Phone { Usage = "Cell", Number = "(71) 555-7773" });
            e7.ContactDetails.Add(new Phone { Usage = "Cell", Number = "(71) 555-5598" });
            e8.ContactDetails.Add(new Phone { Usage = "Cell", Number = "(206) 555-1189" });
            e9.ContactDetails.Add(new Phone { Usage = "Cell", Number = "(71) 555-4444" });

            e1.ContactDetails.Add(new Email { Usage = "Business", Address = "*****@*****.**" });
            e2.ContactDetails.Add(new Email { Usage = "Business", Address = "*****@*****.**" });
            e3.ContactDetails.Add(new Email { Usage = "Business", Address = "*****@*****.**" });
            e4.ContactDetails.Add(new Email { Usage = "Business", Address = "*****@*****.**" });
            e5.ContactDetails.Add(new Email { Usage = "Business", Address = "*****@*****.**" });
            e6.ContactDetails.Add(new Email { Usage = "Personal", Address = "*****@*****.**" });
            e7.ContactDetails.Add(new Email { Usage = "Personal", Address = "*****@*****.**" });
            e8.ContactDetails.Add(new Email { Usage = "Personal", Address = "*****@*****.**" });
            e9.ContactDetails.Add(new Email { Usage = "Personal", Address = "*****@*****.**" });

            e1.Manager = e2;
            e3.Manager = e2;
            e4.Manager = e2;
            e5.Manager = e2;
            e6.Manager = e5;
            e7.Manager = e5;
            e8.Manager = e2;
            e9.Manager = e5;

            FakeEmployeeContext context = new FakeEmployeeContext(
                new List<Employee> { e1, e2, e3, e4, e5, e6, e7, e8, e9 },
                new List<Department> { sales, corporate, purchasing, marketing });
            return context;
        }