public void ShouldFindEmployeeByUsername()
        {
            new DatabaseTester().Clean();

            ISession session = DataContext.GetTransactedSession();
            var one = new Employee("1", "first1", "last1", "email1");
            var two = new Employee("2", "first2", "last2", "email2");
            var three = new Employee("3", "first3", "last3", "email3");
            session.SaveOrUpdate(one);
            session.SaveOrUpdate(two);
            session.SaveOrUpdate(three);
            session.Transaction.Commit();
            session.Dispose();

            IEmployeeRepository repository = new EmployeeRepository();
            Employee employee = repository.GetByUserName("1");
            Assert.That(employee.Id, Is.EqualTo(one.Id));
        }
        public void ShouldGetAllEmployees()
        {
            new DatabaseTester().Clean();

            ISession session = DataContext.GetTransactedSession();
            var one = new Employee("1", "first1", "last1", "email1");
            var two = new Employee("2", "first2", "last2", "email2");
            var three = new Employee("3", "first3", "last3", "email3");
            session.SaveOrUpdate(two);
            session.SaveOrUpdate(three);
            session.SaveOrUpdate(one);
            session.Transaction.Commit();
            session.Dispose();

            IEmployeeRepository repository = new EmployeeRepository();
            Employee[] employees = repository.GetEmployees(EmployeeSpecification.All);

            Assert.That(employees.Length, Is.EqualTo(3));
            Assert.That(employees[0].UserName, Is.EqualTo("1"));
            Assert.That(employees[0].FirstName, Is.EqualTo("first1"));
            Assert.That(employees[0].LastName, Is.EqualTo("last1"));
            Assert.That(employees[0].EmailAddress, Is.EqualTo("email1"));
        }
        public void ShouldGetAllEmployeesForFulfillment()
        {
            new DatabaseTester().Clean();

            ISession session = DataContext.GetTransactedSession();
            var role = new Role("foo");
            var one = new Employee("1", "first1", "last1", "email1");
            one.AddRole(role);
            var two = new Employee("2", "first2", "last2", "email2");
            two.AddRole(role);
            var three = new Employee("3", "first3", "last3", "email3");
            session.SaveOrUpdate(role);
            session.SaveOrUpdate(two);
            session.SaveOrUpdate(three);
            session.SaveOrUpdate(one);
            session.Transaction.Commit();
            session.Dispose();

            IEmployeeRepository repository = new EmployeeRepository();
            Employee[] employees =
                repository.GetEmployees(new EmployeeSpecification(true));

            Assert.That(employees.Length, Is.EqualTo(2));
        }