예제 #1
0
        public void TestUpdate()
        {
            IEmployeeRepository employeeRepository = new MockEmployeeRepository();
            EmployeeService     employeeService    = new EmployeeService(employeeRepository);

            DistributionCentre locationCentre = new DistributionCentre
            {
                CentreId = 1,
                Name     = "North Centre"
            };

            var result = employeeService.Update("*****@*****.**", "Fred Smith", "*****@*****.**", locationCentre, EmployeeType.Doctor);

            Assert.AreEqual <bool>(true, result.Success);
        }
예제 #2
0
        public void TestUpdate_EmailAddressEmpty()
        {
            IEmployeeRepository employeeRepository = new MockEmployeeRepository();
            EmployeeService     employeeService    = new EmployeeService(employeeRepository);

            DistributionCentre locationCentre = new DistributionCentre
            {
                CentreId = 1,
                Name     = "North Centre"
            };

            var result = employeeService.Update("*****@*****.**", "Fred Smith", string.Empty, locationCentre, EmployeeType.Doctor);

            Assert.AreEqual <bool>(false, result.Success);
            Assert.AreEqual <string>(EmployeeResult.EmailAddressCannotByEmpty, result.ErrorMessage);
        }
예제 #3
0
        public void TestUpdate_UsernameNotFound()
        {
            IEmployeeRepository employeeRepository = new MockEmployeeRepository();
            EmployeeService     employeeService    = new EmployeeService(employeeRepository);

            DistributionCentre locationCentre = new DistributionCentre
            {
                CentreId = 1,
                Name     = "North Centre"
            };

            var result = employeeService.Update("badusername", "Fred Smith", "*****@*****.**", locationCentre, EmployeeType.Doctor);

            Assert.AreEqual <bool>(false, result.Success);
            Assert.AreEqual <string>(EmployeeResult.UserNameCannotBeFound, result.ErrorMessage);
        }