Example #1
0
        public void ChangeDirectMethod()
        {
            int empid           = 14;
            AddHourlyEmployee t = new AddHourlyEmployee(empid, "Bob", "Home", 313);

            t.Execute();
            ChangeDirectTransaction cdt = new ChangeDirectTransaction(empid, "sberbank", "123456789");

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

            Assert.IsNotNull(e);
            Assert.AreEqual("Direct sberbank 123456789", e.Method.ToString());
        }
Example #2
0
        public void ChangeMailMethod()
        {
            int empid           = 15;
            AddHourlyEmployee t = new AddHourlyEmployee(empid, "Bill", "Home", 313);

            t.Execute();
            ChangeMailTransaction cmt = new ChangeMailTransaction(empid, "*****@*****.**");

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

            Assert.IsNotNull(e);
            Assert.AreEqual("Mail [email protected]", e.Method.ToString());
        }
Example #3
0
        public void ChangeAddressTransaction()
        {
            int empid           = 10;
            AddHourlyEmployee t = new AddHourlyEmployee(empid, "Bob", "Home", 23.41);

            t.Execute();
            ChangeAddressTransaction cat = new ChangeAddressTransaction(empid, "Home2");

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

            Assert.IsNotNull(e);
            Assert.AreEqual("Home2", e.Address);
        }
Example #4
0
        public void ChangeNameTransaction()
        {
            int empid           = 9;
            AddHourlyEmployee t = new AddHourlyEmployee(empid, "Bill", "Home", 265);

            t.Execute();
            ChangeNameTransaction cnt = new ChangeNameTransaction(empid, "Bob");

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

            Assert.IsNotNull(e);
            Assert.AreEqual("Bob", e.Name);
        }
Example #5
0
        public void DeleteEmployee()
        {
            int empid = 5;
            AddCommissionedEmployee t = new AddCommissionedEmployee(empid, "Bill", "Home", 265, 123.804);

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

            Assert.IsNotNull(e);
            DeleteEmployeeTransaction dt = new DeleteEmployeeTransaction(empid);

            dt.Execute();
            e = PayrollDatabase.GetEmployee_Static(empid);
            Assert.IsNull(e);
        }
Example #6
0
        public void SalesReceiptTransaction()
        {
            int empid = 7;
            AddCommissionedEmployee s = new AddCommissionedEmployee(empid, "Bill", "Home", 38, 25000);

            s.Execute();
            SalesReceiptTransaction crt = new SalesReceiptTransaction(new DateTime(2015, 10, 31), 15.15, empid);

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

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

            Assert.IsTrue(pc is CommissionedClassification);
            CommissionedClassification cc = pc as CommissionedClassification;
            SalesReceipt sr = cc.GetSalary(new DateTime(2015, 10, 31));

            Assert.IsNotNull(sr);
            Assert.AreEqual(15.15, sr.Amount);
        }
Example #7
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);
        }
Example #8
0
        public void AddHourlyEmployee()
        {
            int empid           = 3;
            AddHourlyEmployee t = new AddHourlyEmployee(empid, "Bill", "Home", 265);

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

            Assert.AreEqual("Bill", e.Name);
            PaymentClassification pc = e.Classification;

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

            Assert.AreEqual(265, sc.Hourly, .001);
            PaymentSchedule ps = e.Schedule;

            Assert.IsTrue(ps is WeeklySchedule);
            PaymentMethod pm = e.Method;

            Assert.IsTrue(pm is HoldMethod);
        }
Example #9
0
        public void AddCommissionedEmployee()
        {
            int empid = 4;
            AddCommissionedEmployee t = new AddCommissionedEmployee(empid, "Bob", "Home", 265, 10);

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

            Assert.AreEqual("Bob", e.Name);
            PaymentClassification pc = e.Classification;

            Assert.IsTrue(pc is CommissionedClassification);
            CommissionedClassification sc = pc as CommissionedClassification;

            Assert.AreEqual(10, sc.Commission, .001);
            Assert.AreEqual(265, sc.Salary, .001);
            PaymentSchedule ps = e.Schedule;

            Assert.IsTrue(ps is BiweeklySchedule);
            PaymentMethod pm = e.Method;

            Assert.IsTrue(pm is HoldMethod);
        }
Example #10
0
        public void ChangeSalariedTransaction()
        {
            int empid           = 12;
            AddHourlyEmployee t = new AddHourlyEmployee(empid, "Bob", "Home", 23.41);

            t.Execute();
            ChangeSalariedTransaction cht = new ChangeSalariedTransaction(empid, 20.44);

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

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

            Assert.IsNotNull(pc);
            Assert.IsTrue(pc is SalariedClassification);
            SalariedClassification sc = pc as SalariedClassification;

            Assert.AreEqual(20.44, sc.Salary);
            PaymentSchedule ps = e.Schedule;

            Assert.IsTrue(ps is MonthlySchedule);
        }
Example #11
0
        public void ChangeHourlyTransaction()
        {
            int empid = 11;
            AddCommissionedEmployee t = new AddCommissionedEmployee(empid, "Bill", "Home", 23.41, 3.2);

            t.Execute();
            ChangeHourlyTransaction cht = new ChangeHourlyTransaction(empid, 19.84);

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

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

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

            Assert.AreEqual(19.84, hc.Hourly, .001);
            PaymentSchedule ps = e.Schedule;

            Assert.IsTrue(ps is WeeklySchedule);
        }
Example #12
0
        public void AddserviceCharge()
        {
            int empid           = 8;
            AddHourlyEmployee t = new AddHourlyEmployee(empid, "Bob", "Home", 23.41);

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

            Assert.IsNotNull(e);
            UnionAffiliation af = new UnionAffiliation();

            e.Affiliation = af;
            int memberId = 86;

            PayrollDatabase.AddUnionMember_Static(memberId, e);
            ServiceChargeTransaction sct = new ServiceChargeTransaction(memberId, new DateTime(2015, 11, 8), 12.95);

            sct.Execute();
            ServiceCharge sc = af.GetServiceCharge(new DateTime(2015, 11, 8));

            Assert.IsNotNull(sc);
            Assert.AreEqual(12.95, sc.Charge, .001);
        }
Example #13
0
        public void ChangeUnionMember()
        {
            int empid           = 16;
            AddHourlyEmployee t = new AddHourlyEmployee(empid, "Bob", "Home", 256.1);

            t.Execute();
            int memberId = 7743;
            ChangeMemberTransaction cmt = new ChangeMemberTransaction(empid, memberId, 99.42);

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

            Assert.IsNotNull(e);
            Affiliation affiliation = e.Affiliation;

            Assert.IsNotNull(affiliation);
            Assert.IsTrue(affiliation is UnionAffiliation);
            UnionAffiliation uf = affiliation as UnionAffiliation;

            Assert.AreEqual(99.42, uf.Charge, .001);
            Employee member = PayrollDatabase.GetUnionMember_Static(memberId);

            Assert.AreEqual(e, member);
        }
Example #14
0
        public void ChangeCommissionedTransaction()
        {
            int empid             = 13;
            AddSalariedEmployee t = new AddSalariedEmployee(empid, "Bill", "Home", 23.41);

            t.Execute();
            ChangeCommissionedTransaction cht = new ChangeCommissionedTransaction(empid, 20.44, 10);

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

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

            Assert.IsNotNull(pc);
            Assert.IsTrue(pc is CommissionedClassification);
            CommissionedClassification sc = pc as CommissionedClassification;

            Assert.AreEqual(10, sc.Commission);
            Assert.AreEqual(20.44, sc.Salary);
            PaymentSchedule ps = e.Schedule;

            Assert.IsTrue(ps is BiweeklySchedule);
        }