Example #1
0
        public void TestMethod_definiteEmp_AddingPeopleWithSameIDs()
        {
            /* Container class "Faculty" is generating
             * employee ID by it's built-in start value of 1.
             */
            Faculty testFax = new Faculty("ETF");

            testFax.AddDefiniteEmployee("name", "surname", new DateTime(1970, 1, 1), "5555555555555", employmentPosition_OnContract.demonstrator, new DateTime(2017, 1, 1), new DateTime(2019, 1, 1), 10);
            testFax.AddDefiniteEmployee("name", "surname", new DateTime(1970, 1, 1), "5555555555555", employmentPosition_OnContract.gostujuciPredavac, new DateTime(2017, 1, 1), new DateTime(2019, 1, 1), 10);
        }
Example #2
0
        public void TestMethod_InputOfMoreDefiniteEmp()
        {
            Faculty testFax = new Faculty("ETF");

            testFax.AddDefiniteEmployee("name", "surname", new DateTime(1970, 1, 1), "5555555555555", employmentPosition_OnContract.demonstrator, new DateTime(2017, 1, 1), new DateTime(2019, 1, 1), 10);
            testFax.AddDefiniteEmployee("name", "surname", new DateTime(1970, 1, 1), "5555555555556", employmentPosition_OnContract.gostujuciPredavac, new DateTime(2017, 1, 1), new DateTime(2019, 1, 1), 10);
            testFax.AddDefiniteEmployee("name", "surname", new DateTime(1970, 1, 1), "5555555555557", employmentPosition_OnContract.demonstrator, new DateTime(2017, 1, 1), new DateTime(2019, 1, 1), 10);
            testFax.AddDefiniteEmployee("name", "surname", new DateTime(1970, 1, 1), "5555555555558", employmentPosition_OnContract.demonstrator, new DateTime(2017, 1, 1), new DateTime(2019, 1, 1), 10);
            testFax.AddDefiniteEmployee("name", "surname", new DateTime(1970, 1, 1), "5555555555559", employmentPosition_OnContract.strucnjakIzPrakse, new DateTime(2017, 1, 1), new DateTime(2019, 1, 1), 10);
            Assert.AreEqual(testFax.ListOfDefiniteContractEmployees.Count, 5);

            CollectionAssert.AllItemsAreUnique(testFax.ListOfDefiniteContractEmployees);
            CollectionAssert.AllItemsAreUnique(testFax.ListOfEmployees);
            CollectionAssert.AllItemsAreNotNull(testFax.ListOfDefiniteContractEmployees);
            CollectionAssert.IsSubsetOf(testFax.ListOfDefiniteContractEmployees, testFax.ListOfEmployees);
        }
Example #3
0
        public void TestMethod_definiteEmp_ValidityOfGeneratedWorkIDs()
        {
            /* Container class "Faculty" is generating
             * employee ID by it's built-in start value of 1.
             */
            Faculty testFax = new Faculty("ETF");

            testFax.AddDefiniteEmployee("name", "surname", new DateTime(1970, 1, 1), "5555555555555", employmentPosition_OnContract.demonstrator, new DateTime(2017, 1, 1), new DateTime(2019, 1, 1), 10);
            testFax.AddDefiniteEmployee("name", "surname", new DateTime(1970, 1, 1), "5555555555556", employmentPosition_OnContract.gostujuciPredavac, new DateTime(2017, 1, 1), new DateTime(2019, 1, 1), 10);
            testFax.AddDefiniteEmployee("name", "surname", new DateTime(1970, 1, 1), "5555555555557", employmentPosition_OnContract.demonstrator, new DateTime(2017, 1, 1), new DateTime(2019, 1, 1), 10);
            testFax.AddDefiniteEmployee("name", "surname", new DateTime(1970, 1, 1), "5555555555558", employmentPosition_OnContract.demonstrator, new DateTime(2017, 1, 1), new DateTime(2019, 1, 1), 10);
            testFax.AddDefiniteEmployee("name", "surname", new DateTime(1970, 1, 1), "5555555555559", employmentPosition_OnContract.strucnjakIzPrakse, new DateTime(2017, 1, 1), new DateTime(2019, 1, 1), 10);
            Assert.AreEqual(testFax.ListOfDefiniteContractEmployees[0].EmploymentID, 1);
            Assert.AreEqual(testFax.ListOfDefiniteContractEmployees[1].EmploymentID, 2);
            Assert.AreEqual(testFax.ListOfDefiniteContractEmployees[2].EmploymentID, 3);
            Assert.AreEqual(testFax.ListOfDefiniteContractEmployees[3].EmploymentID, 4);
            Assert.AreEqual(testFax.ListOfDefiniteContractEmployees[4].EmploymentID, 5);
        }
Example #4
0
        public void DataDrivenTest_CreatingDefiniteEmployeeFromDatabase()
        {
            employeeDEFINITEContract test = new employeeDEFINITEContract(TestContext.DataRow["Name"].ToString(), TestContext.DataRow["Surname"].ToString(), Convert.ToDateTime(TestContext.DataRow["DateOfBirth"]), TestContext.DataRow["IDNumber"].ToString(), Convert.ToInt32(TestContext.DataRow["EmployeeID"]), employmentPosition_OnContract.demonstrator, Convert.ToDateTime(TestContext.DataRow["StartOfContract"]), Convert.ToDateTime(TestContext.DataRow["EndOfContract"]), Convert.ToInt32(TestContext.DataRow["NmbOfClassesWeekly"]));

            Faculty testFax = new Faculty("ETF");

            testFax.AddDefiniteEmployee(TestContext.DataRow["Name"].ToString(), TestContext.DataRow["Surname"].ToString(), Convert.ToDateTime(TestContext.DataRow["DateOfBirth"]), TestContext.DataRow["IDNumber"].ToString(), employmentPosition_OnContract.demonstrator, Convert.ToDateTime(TestContext.DataRow["StartOfContract"]), Convert.ToDateTime(TestContext.DataRow["EndOfContract"]), Convert.ToInt32(TestContext.DataRow["NmbOfClassesWeekly"]));
            Assert.IsTrue(test.IDnumber == testFax.FindEmployee(Convert.ToString(TestContext.DataRow["IDNumber"])));
        }
Example #5
0
        public void TestMethod_DeletingDefiniteEmployee_ByID()
        {
            Faculty testFax = new Faculty("ETF");

            testFax.AddDefiniteEmployee("name", "surname", new DateTime(1970, 1, 1), "5555555555555", employmentPosition_OnContract.demonstrator, new DateTime(2017, 1, 1), new DateTime(2019, 1, 1), 10);
            Assert.AreEqual(testFax.ListOfEmployees.Count, 1);
            Assert.AreEqual(testFax.ListOfDefiniteContractEmployees.Count, 1);

            testFax.deleteEmployeeByID("5555555555555");
            Assert.AreEqual(testFax.ListOfEmployees.Count, 0);
            Assert.AreEqual(testFax.ListOfDefiniteContractEmployees.Count, 0);
        }
Example #6
0
        public void TestMethod_InputDefiniteEmp()
        {
            Faculty testFax = new Faculty("ETF");

            /* employeeDEFINITEContract(string name, string surname, DateTime dateOfBirth, string IDnumber, int employeeID, employmentPosition_OnContract employeePosition, DateTime startOfContract, DateTime endOfContract, int numberOfClassesWeekly) */

            /* We add object employee by sending parameters of
             * the employee constructor without "employee ID"
             * because like in the case of students, the container
             * class "Faculty" generates unique ID for it.
             */
            testFax.AddDefiniteEmployee("name", "surname", new DateTime(1970, 1, 1), "5555555555555", employmentPosition_OnContract.demonstrator, new DateTime(2017, 1, 1), new DateTime(2019, 1, 1), 10);
        }
        public void TestMethod_definiteEmp_strucnjakIzPrakseSalary()
        {
            Faculty testFax = new Faculty("ETF");

            testFax.AddDefiniteEmployee("name", "surname", new DateTime(1970, 1, 1), "5555555555555", employmentPosition_OnContract.strucnjakIzPrakse, new DateTime(2017, 1, 1), new DateTime(2019, 1, 1), 10);
            double salary = testFax.ListOfDefiniteContractEmployees[0].Salary;

            /* Strucnjak iz prakse:
             * Salary = (numberOfClassesWeekly * 20) + 150;
             * Salary = (10 * 20) + 150
             */
            Assert.AreEqual(salary, (10 * 20) + 150);
        }
        public void TestMethod_definiteEmp_gostujuciPredavacSalary()
        {
            Faculty testFax = new Faculty("ETF");

            testFax.AddDefiniteEmployee("name", "surname", new DateTime(1970, 1, 1), "5555555555555", employmentPosition_OnContract.gostujuciPredavac, new DateTime(2017, 1, 1), new DateTime(2019, 1, 1), 10);
            double salary = testFax.ListOfDefiniteContractEmployees[0].Salary;

            /* Gostujuci predavac:
             * Salary = (numberOfClassesWeekly* 15) * (endOfContract - startOfContract).TotalDays;
             * Salary = 10 * 15 * 2 *365 (because the work period is from 2017 do 2019
             */
            Assert.AreEqual(salary, 10 * 15 * 2 * 365);
        }
Example #9
0
        public void TestMethod_definiteEmp_ValidityOfChangedData()
        {
            Faculty testFax = new Faculty("ETF");

            testFax.AddDefiniteEmployee("name", "surname", new DateTime(1970, 1, 1), "5555555555555", employmentPosition_OnContract.demonstrator, new DateTime(2017, 1, 1), new DateTime(2019, 1, 1), 10);

            testFax.ListOfDefiniteContractEmployees[0].Name = "changedName";
            string name = testFax.ListOfDefiniteContractEmployees[0].Name;

            Assert.AreEqual(name, "changedName");

            testFax.ListOfDefiniteContractEmployees[0].Surname = "changedSurname";
            string surname = testFax.ListOfDefiniteContractEmployees[0].Surname;

            Assert.AreEqual(surname, "changedSurname");

            testFax.ListOfDefiniteContractEmployees[0].DateOfBirth = new DateTime(1990, 1, 1);
            DateTime birth = testFax.ListOfDefiniteContractEmployees[0].DateOfBirth;

            Assert.AreEqual(birth, new DateTime(1990, 1, 1));

            testFax.ListOfDefiniteContractEmployees[0].IDnumber = "6666666666666";
            string ID = testFax.ListOfDefiniteContractEmployees[0].IDnumber;

            Assert.AreEqual(ID, "6666666666666");

            testFax.ListOfDefiniteContractEmployees[0].EmployeePosition = employmentPosition_OnContract.gostujuciPredavac;
            employmentPosition_OnContract position = testFax.ListOfDefiniteContractEmployees[0].EmployeePosition;

            Assert.AreEqual(position, employmentPosition_OnContract.gostujuciPredavac);

            testFax.ListOfDefiniteContractEmployees[0].StartOfContract = new DateTime(2018, 1, 1);
            DateTime contractStart = testFax.ListOfDefiniteContractEmployees[0].StartOfContract;

            Assert.AreEqual(contractStart, new DateTime(2018, 1, 1));

            testFax.ListOfDefiniteContractEmployees[0].EndOfContract = new DateTime(2021, 1, 1);
            DateTime contractEnd = testFax.ListOfDefiniteContractEmployees[0].EndOfContract;

            Assert.AreEqual(contractEnd, new DateTime(2021, 1, 1));

            testFax.ListOfDefiniteContractEmployees[0].NumberOfClassesWeekly = 15;
            int classes = testFax.ListOfDefiniteContractEmployees[0].NumberOfClassesWeekly;

            Assert.AreEqual(classes, 15);
        }
Example #10
0
        public void TestMethod_definiteEmp_NegativeNmbOfClasses()
        {
            Faculty testFax = new Faculty("ETF");

            testFax.AddDefiniteEmployee("name", "surname", new DateTime(1970, 1, 1), "5555555555555", employmentPosition_OnContract.demonstrator, new DateTime(2017, 1, 1), new DateTime(2019, 1, 1), -10);
        }
Example #11
0
        public void TestMethod_definiteEmp_InvaliStartOfContract_AfterEnd()
        {
            Faculty testFax = new Faculty("ETF");

            testFax.AddDefiniteEmployee("name", "surname", new DateTime(1970, 1, 1), "5555555555555", employmentPosition_OnContract.demonstrator, new DateTime(2025, 1, 1), new DateTime(2019, 1, 1), 10);
        }
Example #12
0
        public void TestMethod_definiteEmp_InvalidDateOfBirth()
        {
            Faculty testFax = new Faculty("ETF");

            testFax.AddDefiniteEmployee("name", "surname", new DateTime(2020, 1, 1), "5555555555555", employmentPosition_OnContract.demonstrator, new DateTime(2017, 1, 1), new DateTime(2019, 1, 1), 10);
        }