示例#1
0
        public void TestChangeUnionMember()
        {
            int empId           = 8;
            AddHourlyEmployee t = new AddHourlyEmployee(empId, "Lance", "Home", 13.37m);

            t.Execute();
            int memberId = 7742;
            ChangeAffiliationTransaction cat = new ChangeMemberTransaction(empId, memberId, 99.42m);

            cat.Execute();
            Employee e = PayrollDatabase.GetEmployee(empId);

            Assert.That(e, Is.Not.Null);
            Affiliation affiliation = e.Affiliation;

            Assert.That(affiliation, Is.Not.Null);
            Assert.That(affiliation is UnionAffiliation);
            UnionAffiliation ua = affiliation as UnionAffiliation;

            Assert.That(ua.Dues, Is.EqualTo(99.42m));
            Employee member = PayrollDatabase.GetUnionMember(memberId);

            Assert.That(member, Is.Not.Null);
            Assert.That(e, Is.EqualTo(member));
        }
示例#2
0
        public void TestAddServiceCharge()
        {
            int empId           = 2;
            AddHourlyEmployee t = new AddHourlyEmployee(empId, "Bill", "Home", 15.75m);

            t.Execute();
            Employee e = PayrollDatabase.GetEmployee(empId);

            Assert.That(e, Is.Not.Null);

            UnionAffiliation ua = new UnionAffiliation();

            e.Affiliation = ua;
            int memberId = 86;

            PayrollDatabase.AddUnionMember(memberId, empId);

            ServiceChargeTransaction sct = new ServiceChargeTransaction(memberId, new DateTime(2020, 02, 02), 12.95m);

            sct.Execute();
            ServiceCharge sc = ua.GetServiceCharge(new DateTime(2020, 02, 02));

            Assert.That(sc, Is.Not.Null);
            Assert.That(sc.Amount, Is.EqualTo(12.95m));
        }