public void TestChangeAddressTransaction()
        {
            // Arrange
            var employeeId      = 1;
            var employeeName    = "Bogdan";
            var employeeAddress = "Address";
            var hourlyRate      = 2500;

            new AddHourlyEmployeeTransaction(employeeId, employeeName, employeeAddress, hourlyRate).Execute();

            const string newAddress = "new York";

            // Act
            new ChangeEmployeeAddressTransaction(employeeId, newAddress).Execute();
            var employee = payrollRepository.GetEmployee(employeeId);

            // Assert
            Assert.IsNotNull(employee);
            Assert.AreEqual(newAddress, employee.Address);
        }
Exemple #2
0
        public void TestAddCommisionedEmployee()
        {
            // Arrange
            var employeeId      = 1;
            var employeeName    = "Bogdan";
            var employeeAddress = "Address";
            var salary          = 2500;
            var commisionRate   = 100;

            // Act
            new AddCommisionedEmployeeTransaction(employeeId, employeeName, employeeAddress, salary, commisionRate).Execute();

            var employee = payrollRepository.GetEmployee(employeeId);

            // Assert
            Assert.IsTrue(employee.PaymentClassification is CommisionedPaymentClassification);
            Assert.AreEqual(salary, (employee.PaymentClassification as CommisionedPaymentClassification).Salary);
            Assert.AreEqual(commisionRate, (employee.PaymentClassification as CommisionedPaymentClassification).CommisionRate);
            Assert.IsTrue(employee.PaymentSchedule is BiweeklyPaymentSchedule);
            Assert.IsTrue(employee.PaymentMethod is HoldPaymentMethod);
        }