コード例 #1
0
        public void AddNormalTest()
        {
            EmployeeContainer ec = new EmployeeContainer("test", "AddNormalTestLog");
            ParttimeEmployee pe = new ParttimeEmployee(
                new DateTime(1999, 12, 31),
                new DateTime(2000, 1, 1),
                10,
                "Testy",
                "Peoper",
                new DateTime(1950, 1, 1),
                "111222333"
            );

            Assert.AreEqual(ec.Add(pe), true);
        }
コード例 #2
0
        public void AddExceptionTest()
        {
            EmployeeContainer ec = new EmployeeContainer("test", "AddExceptionTestLog");
            ParttimeEmployee pe = new ParttimeEmployee(
                new DateTime(1999, 12, 31),
                new DateTime(2000, 1, 1),
                10,
                "Testy",
                "Peoper",
                new DateTime(1900, 1, 1), //invalid date of birth
                "111222333"
            );

            Assert.AreEqual(ec.Add(pe), false);
        }
コード例 #3
0
        public void ModifyNormalTest()
        {
            EmployeeContainer ec = new EmployeeContainer("test", "ModifyNormalTestLog");
            ParttimeEmployee pe = new ParttimeEmployee(
                new DateTime(1999, 12, 31),
                new DateTime(2000, 1, 1),
                10,
                "Testy",
                "Peoper",
                new DateTime(1950, 1, 1),
                "111222333"
            );

            ec.Add(pe);

            FulltimeEmployee fe = new FulltimeEmployee(
                new DateTime(2004, 3, 6),
                new DateTime(2010, 1, 17),
                1000,
                "Dirty",
                "Dan",
                new DateTime(1975, 5, 30),
                "333222111"
            );

            Assert.AreEqual(ec.Modify(0, fe), true);
        }
コード例 #4
0
        public void GetCopyAtNormalTest()
        {
            EmployeeContainer ec = new EmployeeContainer("test", "GetCopyAtNormalTestLog");
            ParttimeEmployee pe = new ParttimeEmployee(
                new DateTime(1999, 12, 31),
                new DateTime(2000, 1, 1),
                10,
                "Testy",
                "Peoper",
                new DateTime(1950, 1, 1),
                "111222333"
            );

            ec.Add(pe);
            Employee peCopy = ec.GetCopyAt(0);

            Assert.AreEqual(peCopy.Details(), pe.Details());
        }