Example #1
0
        private void btn_create_Click(object sender, EventArgs e)
        {
            String malefemale = "";

            if (rb_female.Checked)
            {
                malefemale = "Female";
            }
            else
            {
                malefemale = "Male";
            }
            int role = 0;

            if (cbb_employee_roles.SelectedIndex == 0)
            {
                role = 2;
            }
            else
            {
                role = 3;
            }

            Employee employee = new Employee(0, txt_employee_firstname.Text, txt_employee_lastname.Text, txt_employee_email.Text, txt_employee_phoneno.Text, (int)num_employee_exp.Value, malefemale, txt_employee_biography.Text, role);

            employee.Password = txt_employee_password.Text;
            employeesController.CreateNewEmployee(employee);
            this.Close();
        }
Example #2
0
        public void CheckIfCreateNewEmployeeWorks()
        {
            // Arrange
            var employeesController = new EmployeesController()
            {
                Request = new HttpRequestMessage
                {
                    RequestUri = new Uri("http://*****:*****@test.dk", PhoneNo = "11223344", Experience = 2, Gender = "Male", Biography = "Test", Password = "******", RoleId = 2, PasswordHash = "", Salt = ""
                };
                var response = employeesController.CreateNewEmployee(employee);

                // Assert
                Assert.IsTrue(response.IsSuccessStatusCode);
                Assert.AreEqual("TestEmployee", employee.FirstName);
            }
            catch (Exception)
            {
                Assert.Fail();
            }
        }