コード例 #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);
        }