Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            Console.ForegroundColor = ConsoleColor.Red;
            Console.WriteLine("LINKED LIST TEST\n\n");
            Console.ResetColor();

            LinkedList linkedlista = new LinkedList();

            Videogame v = new Videogame("Battlefront", 0, 90000, Videogame.Plataforma.XBOX, 2015, "action", "EA");

            Employee e1 = new Employee("John", "Snow", "OfTheNightWatch", "DEAD", 5);

            linkedlista.add(v);
            linkedlista.add(e1);
            linkedlista.add("Hello i'm a string");
            linkedlista.add(14);
            linkedlista.add(14.67);

            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.WriteLine(linkedlista.ToString() + "\n");
            Console.WriteLine("The size of the list is: " + linkedlista.size + "\n");
            Console.ResetColor();

            Console.ForegroundColor = ConsoleColor.Red;
            Console.WriteLine("COUNT WORD TEST\n");
            Console.ResetColor();

            Console.ForegroundColor = ConsoleColor.Yellow;
            String phrase = "Tis sentence is for prove that the method count words works";

            Console.WriteLine("The number of words is : " + phrase.ContarPalabras() + "\n");
            Console.ResetColor();

            Console.ForegroundColor = ConsoleColor.Red;
            Console.WriteLine("FILTER TEST\n");
            Console.ResetColor();

            /// FILTER

            Employee[] list = DefaultParameters.CreateEmployees();

            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.WriteLine("Employees whose name is 'Maria':\n");

            Console.ForegroundColor = ConsoleColor.Cyan;
            foreach (Employee e in DefaultParameters.Filter(list, name: "María"))
            {
                Console.WriteLine(e.ToString() + "\n");
            }

            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.WriteLine("Employees with its two surnames equal to 'Pérez':\n");

            Console.ForegroundColor = ConsoleColor.Cyan;
            foreach (Employee e in DefaultParameters.Filter(list, surname1: "Pérez", surname2: "Pérez"))
            {
                Console.WriteLine(e.ToString() + "\n");
            }

            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.WriteLine("Employees whose NIF contains 'A':\n");

            Console.ForegroundColor = ConsoleColor.Cyan;
            foreach (Employee e in DefaultParameters.Filter(list, nifContains: "A"))
            {
                Console.WriteLine(e.ToString() + "\n");
            }


            Console.ResetColor();
        }
Ejemplo n.º 2
0
        public void TesAdd()
        {
            list.add(e);
            list.add(new Videogame("GTA", 100, 900000, Videogame.Plataforma.PS3,
                                   2014, "Sandbox", "Rockstar"));
            list.add(13);
            list.add("Hola");
            list.add(13.42);

            Assert.AreEqual(5, list.size);
            Assert.AreEqual("Employee: Palomo asdf, Juan with NIF: 123124B. Total workhours" +
                            " = 4.  GTA, for PS3. Editor: Rockstar  13  Hola  13,42  ", list.ToString());
        }