Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Enter your name: ");
            string name = Console.ReadLine();

            Console.WriteLine("Hello " + name + "!");
            Console.ReadLine();

            ComputerList computerList = new ComputerList();

            computerList.Seed();


            /*
             * foreach (Computer comp in computerList)
             * {
             *  Console.WriteLine(comp.Manufacturer + ":" + comp.Model);
             * }
             */


            //Do same code as above with lambda expression
            computerList.ForEach(c => Console.WriteLine(c.Manufacturer + ":" + c.Model));

            Console.ReadLine();
        }
Ejemplo n.º 2
0
        public void SeedTest()
        {
            ComputerList computerList = new ComputerList();

            computerList.Seed();

            //Test to see if I have two computers
            int expected = 2;
            int actual   = computerList.Count;

            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 3
0
        private void btnLoadComputers_Click(object sender, EventArgs e)
        {
            try
            {
                computerList = new ComputerList();
                computerList.Seed();

                //bind the data to the screen
                Rebind();
            }
            catch (Exception ex)
            {
                lblStatus.Text      = ex.Message;
                lblStatus.ForeColor = Color.DarkRed;
            }
        }