Ejemplo n.º 1
0
    static void Main()
    {
        // Create some new employees.
        SalesEmployee employee1 = new SalesEmployee("Alice", 1000, 500);
        Employee      employee2 = new Employee("Bob", 1200);

        Console.WriteLine("Employee4 " + employee1.name + " earned: " + employee1.CalculatePay());
        Console.WriteLine("Employee4 " + employee2.name + " earned: " + employee2.CalculatePay());
    }
        static void Main()
        {
            var employee1 = new SalesEmployee("Alice",
                                              1000, 500);
            var employee2 = new Employee("Bob", 1200);

            Console.WriteLine($"Employee1 {employee1.name} earned: {employee1.CalculatePay()}");
            Console.WriteLine($"Employee2 {employee2.name} earned: {employee2.CalculatePay()}");
        }
        public static void TestTheOverride()
        {
            // Create some new employees.
            var employee1 = new SalesEmployee("Alice",
                                              1000, 500);
            var employee2 = new Employee("Bob", 1200);

            Console.WriteLine("Employee4 " + employee1.name +
                              " earned: " + employee1.CalculatePay());
            Console.WriteLine("Employee4 " + employee2.name +
                              " earned: " + employee2.CalculatePay());
        }
    static void Main()
    {
        // Create some new employees.
            SalesEmployee employee1 = new SalesEmployee("Alice",
                          1000, 500);
            Employee employee2 = new Employee("Bob", 1200);

            Console.WriteLine("Employee4 " + employee1.name +
                      " earned: " + employee1.CalculatePay());
            Console.WriteLine("Employee4 " + employee2.name +
                      " earned: " + employee2.CalculatePay());
    }
        public void TestsCalculatePay()
        {
            double        employee1BasePay = 1000;
            double        employee1Bonus   = 500;
            double        employee1Salary  = employee1BasePay + employee1Bonus;
            double        employee2BasePay = 1200;
            SalesEmployee employee1        = new SalesEmployee("Alice", employee1BasePay, employee1Bonus);
            Employee      employee2        = new Employee("Bob", employee2BasePay);

            Assert.Equal(employee1Salary, employee1.CalculatePay());
            Assert.Equal(employee2BasePay, employee2.CalculatePay());
            List <Employee> empleados = new List <Employee>();

            empleados.Add(employee2);
            empleados.Add(employee2);
            EmployeeManager employee3 = new EmployeeManager("Jorge", employee2BasePay, empleados, 0.10);
            double          Calculo   = 1440;

            Assert.Equal(Calculo, employee3.CalculatePay());
        }