Beispiel #1
0
 public void Update(int id, Process.Models.Employee employee)
 {
     try
     {
         _employeeDAL.Update(id, _mapper.Map <DAL.Models.Employee>(employee));
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
Beispiel #2
0
 public Process.Models.Employee Add(Process.Models.Employee employee)
 {
     try
     {
         return(_mapper.Map <Process.Models.Employee>(_employeeDAL.Add(_mapper.Map <DAL.Models.Employee>(employee))));
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
Beispiel #3
0
        public void Update_ReturnsExpectedResult(int id)
        {
            Process.Models.Employee ProcessEmployee = ProcessEmployeeTest;
            DAL.Models.Employee     DALEmployee     = DALEmployeeTest;
            mockEmployeeDAL = new Mock <DAL.Interfaces.IEmployeeDAL>(MockBehavior.Strict);
            mockEmployeeDAL.Setup(a => a.Update(id, It.IsAny <DAL.Models.Employee>()));

            processUnderTest = new Process.EmployeeProcess(mapper, mockEmployeeDAL.Object);

            Assert.DoesNotThrow(() => processUnderTest.Update(id, ProcessEmployee));
        }
Beispiel #4
0
        public void Add_ReturnsExpectedResult(Process.Models.Employee expectedResult)
        {
            Process.Models.Employee ProcessEmployee = ProcessEmployeeTest;
            mockEmployeeDAL = new Mock <DAL.Interfaces.IEmployeeDAL>(MockBehavior.Strict);
            mockEmployeeDAL.Setup(a => a.Add(It.IsAny <DAL.Models.Employee>())).Returns(DALEmployeeTest);

            processUnderTest = new Process.EmployeeProcess(mapper, mockEmployeeDAL.Object);
            Process.Models.Employee result = processUnderTest.Add(ProcessEmployee);


            Assert.IsTrue(result.ToString() == expectedResult.ToString());
        }
Beispiel #5
0
        public void GetById_ReturnsExpectedResult(Process.Models.Employee expectedResult)
        {
            int id = 1;

            //Process.Models.Employee expectedResult = ProcessEmployeeTest;
            mockEmployeeDAL = new Mock <DAL.Interfaces.IEmployeeDAL>(MockBehavior.Strict);
            mockEmployeeDAL.Setup(a => a.GetByID(id)).Returns(DALEmployeeTest);

            processUnderTest = new Process.EmployeeProcess(mapper, mockEmployeeDAL.Object);
            var result = processUnderTest.GetById(id);

            Assert.IsTrue(result.ToString() == expectedResult.ToString());
        }