Exemple #1
0
        public static Employee InstallEmployee(IDatabase database)
        {
            Employee employee = FakeEmployee.GetFakeEmployee(database);

            new EmployeeBL(database).InsertEmployee(employee);

            return(employee);
        }
        public void employee_should_be_able_to_retrieve_addresses()
        {
            Action procedure = () =>
            {
                var employee = FakeEmployee.GetFakeEmployee1(database);

                database.Insert(employee.Address);
                database.Insert(employee);

                var employeeRetrieved = new EmployeeBL(database).RetrieveById(employee.Id);


                Assert.IsTrue(employeeRetrieved.Address.StreetName == "Centre Street");
            };


            database.ExecuteInTest(procedure);
        }
        public void employee_self_join_should_be_supported()
        {
            Action procedure = () =>
            {
                Employee employee = SharedCode.InstallEmployee(database);

                var employee1 = FakeEmployee.GetFakeEmployee1(database);

                employee1.SupervisorId = employee.Id;

                new EmployeeBL(database).InsertEmployee(employee1);

                var employee1Retrieved = new EmployeeBL(database).RetrieveById(employee1.Id);

                Assert.IsTrue(employee1Retrieved.SupervisorId == employee.Id);
                Assert.IsTrue(employee1Retrieved.SupervisorFistName == employee.FirstName);
                Assert.IsTrue(employee1Retrieved.SupervisorLastName == employee.LastName);
            };


            database.ExecuteInTest(procedure);
        }