public void TestTimeCardTransaction()
        {
            int empId           = 5;
            var name            = "Łukasz";
            var hourlyRate      = 15.25;
            var date            = new DateTime(2005, 7, 31);
            var hours           = 8.0;
            AddHourlyEmployee t = new AddHourlyEmployee(empId, name, "Home", hourlyRate);

            t.Execute();

            TimeCardTransaction tct = new TimeCardTransaction(date, hours, empId);

            tct.Execute();

            Employee e = PayrollDatabase.GetEmployee(empId);

            Assert.IsNotNull(e);

            IPaymentClassification pc = e.Classification;

            Assert.IsTrue(pc is HourlyClassification);
            HourlyClassification hc = pc as HourlyClassification;

            TimeCard tc = hc.GetTimeCard(date);

            Assert.IsNotNull(tc);
            Assert.AreEqual(hours, tc.Hours);
        }
Пример #2
0
        public void TestAddTimeCard()
        {
            #region Arrange
            int employeeId      = 7;
            AddHourlyEmployee t = new AddHourlyEmployee(employeeId, "user", "home", 97.5);
            t.Execute();

            DateTime            workingDay = new DateTime(2019, 4, 21);
            TimeCardTransaction tct        = new TimeCardTransaction(
                employeeId, workingDay, 8.0
                );
            #endregion

            #region Action
            tct.Execute();
            #endregion

            #region Assert
            Employee e = PayrollRepository.GetEmployee(employeeId);
            e.Should().NotBeNull();

            e.Classification.Should().BeOfType <HourlyClassification>();
            HourlyClassification hc = e.Classification as HourlyClassification;

            TimeCard tc = hc.GetTimeCard(workingDay);
            tc.Should().NotBeNull();
            tc.Hours.Should().Be(8.0);
            #endregion
        }
Пример #3
0
        public void TestTimeCardTransaction()
        {
            int empId           = 5;
            AddHourlyEmployee t =
                new AddHourlyEmployee(empId, "Bill", "Home", 15.25, database);

            t.Execute();
            TimeCardTransaction tct =
                new TimeCardTransaction(
                    new DateTime(2005, 7, 31), 8.0, empId, database);

            tct.Execute();

            Employee e = database.GetEmployee(empId);

            Assert.IsNotNull(e);

            PaymentClassification pc = e.Classification;

            Assert.IsTrue(pc is HourlyClassification);
            HourlyClassification hc = pc as HourlyClassification;

            TimeCard tc = hc.GetTimeCard(new DateTime(2005, 7, 31));

            Assert.IsNotNull(tc);
            Assert.AreEqual(8.0, tc.Hours);
        }
Пример #4
0
        public void TestTimeCardTransaction()
        {
            int empId = 31;
            var t     = new AddHourlyEmployee(empId, "Bill", "Home", 15.25, database);

            t.Execute();

            var today = DateTime.UtcNow;
            var tct   = new TimeCardTransaction(today, 8.0, empId, database);

            tct.Execute();

            Employee e = database.GetEmployee(empId);

            Assert.IsNotNull(e);

            PaymentClassification pc = e.Classification;

            Assert.IsTrue(pc is HourlyClassification);
            HourlyClassification hc = pc as HourlyClassification;

            TimeCard tc = hc.GetTimeCard(today);

            Assert.IsNotNull(tc);
            Assert.AreEqual(8.0, tc.Hours);
        }
Пример #5
0
        public void TimeCardTransaction()
        {
            int empid           = 6;
            AddHourlyEmployee t = new AddHourlyEmployee(empid, "Bob", "Home", 23.41);

            t.Execute();
            TimeCardTransaction tct = new TimeCardTransaction(new DateTime(2015, 10, 31), 8.0, empid);

            tct.Execute();
            Employee e = PayrollDatabase.GetEmployee_Static(empid);

            Assert.IsNotNull(e);
            PaymentClassification pc = e.Classification;

            Assert.IsTrue(pc is HourlyClassification);
            HourlyClassification hc = pc as HourlyClassification;
            TimeCard             tc = hc.GetTimeCard(new DateTime(2015, 10, 31));

            Assert.IsNotNull(tc);
            Assert.AreEqual(8.0, tc.Hours);
        }
Пример #6
0
        public async Task TimeCardTransaction()
        {
            int empId           = 3;
            AddHourlyEmployee t = new AddHourlyEmployee(empId, "Bill", "Home", 15.25);
            await t.ExecuteAsync();

            TimeCardTransaction tct = new TimeCardTransaction(new DateTime(2005, 7, 31), 8.0, empId);
            await tct.ExecuteAsync();

            Employee e = await PayrollDatabase.GetEmployeeAsync(empId);

            Assert.NotNull(e);

            Classification.PaymentClassification pc = e.Classification;
            Assert.True(pc is HourlyClassification);
            HourlyClassification hc = pc as HourlyClassification;

            TimeCard tc = hc.GetTimeCard(new DateTime(2005, 7, 31));

            Assert.NotNull(tc);
            Assert.Equal(8.0, tc.Hours);
        }
Пример #7
0
        public void TestTimeCardTransaction()
        {
            int empId = 5;

            app.ExexcuteTransaction("addHourlyEmployee", RequestFactory.rf.MakeHourlyEmployeeRequest(empId, "Bob", "Home", 50));

            app.ExexcuteTransaction("addTimeCard", RequestFactory.rf.MakeTimeCardRequest(new DateTime(2005, 7, 31), 8.0, empId));

            Employee e = PayrollDb.GetEmployee(empId);

            Assert.IsNotNull(e);

            PaymentClassification pc = e.Classification;

            Assert.IsTrue(pc is HourlyClassification);
            HourlyClassification hc = pc as HourlyClassification;

            TimeCard tc = hc.GetTimeCard(new DateTime(2005, 7, 31));

            Assert.IsNotNull(tc);
            Assert.AreEqual(8.0, tc.Hours);
        }