public void Valid_Employee_Should_Be_Returned_When_Requested() { // ARRANGE var expectedEmployee = new Employee { EmployeeId = 1, DateOfBirth = new DateTime(1998, 2, 3), DesignationId = 2 }; var uow = Mock.Create<IQTecUnitOfWork>(Behavior.Loose); Mock.Arrange(() => uow.EmployeeRepository.GetById(Arg.AnyInt)).Returns(expectedEmployee); // ACT var classunderTest = new EmployeeManager(uow); // ASSERT var actualEmployee = classunderTest.GetEmployeeById(1); Assert.AreEqual(expectedEmployee, actualEmployee); }
public void Exception_Must_Be_Thrown_If_EmployeeId_Zero() { // ARRANGE var uow = Mock.Create<IQTecUnitOfWork>(Behavior.Loose); // ACT var classunderTest = new EmployeeManager(uow); Employee actualEmployee = null; try { actualEmployee = classunderTest.GetEmployeeById(0); } catch (InvalidEmployeeIdException) { // ASSERT Mock.Assert(classunderTest); Assert.IsNull(actualEmployee); } }