Ejemplo n.º 1
0
        public void AddEmployeeInvalidNameExceptionTest()
        {
            UserRepository repository = new UserRepository();
            User           employee   = new User {
                Username = ""
            };

            repository.AddEmployee(employee);
        }
Ejemplo n.º 2
0
        public void RemoveEmployeeTest()
        {
            UserRepository repository = new UserRepository();
            Role           role       = repository.GetRoleByName("Employee");
            User           employee   = new User
            {
                Username = "******",
                Password = "******",
                Role     = role
            };

            repository.AddEmployee(employee);
            repository.DeleteEmployee(employee);

            repository.DoesUserExists(employee.Username, employee.Password);
        }
Ejemplo n.º 3
0
        public void AddEmployeeTest()
        {
            UserRepository repository       = new UserRepository();
            Role           role             = repository.GetRoleByName("Employee");
            User           expectedEmployee = new User
            {
                Username = "******",
                Password = "******",
                Role     = role
            };

            repository.AddEmployee(expectedEmployee);
            var actualEmployee = repository.GetUserByUserName(expectedEmployee.Username);

            Assert.AreEqual(expectedEmployee.Username, actualEmployee.Username);
            Assert.AreEqual(expectedEmployee.Password, actualEmployee.Password);

            repository.DeleteEmployee(actualEmployee);
        }