Beispiel #1
0
 public HomeTheater()
 {
     smartTV      = new SmartTV();
     bluRay       = new BluRayPlayer();
     speakerLeft  = new Speaker();
     speakerRight = new Speaker();
 }
        public void TestViewing()
        {
            // Let´s watch The Dark Knight on channel 3
            SatelliteReceiver sat = new SatelliteReceiver();

            sat.Power(true);
            sat.SwitchChannel(3);

            AVReceiver avr      = new AVReceiver();
            Speakers   speakers = new Speakers();

            avr.Power(true);
            avr.PlugIn(1, sat);
            avr.ConnectSpeakers(speakers);
            avr.ChangeSource(1);

            TV tv = new TV();

            tv.Power(true);
            tv.PlugIn(avr);

            string outputVideo = Encoding.Default.GetString(tv.Watch());

            Assert.AreEqual("You wanna know how I got these scars?", outputVideo);

            BluRayPlayer bp = new BluRayPlayer();

            bp.Power(true);
            bp.InsertDisc(LifeOfBrianBluRay);

            avr.PlugIn(2, bp);
            avr.ChangeSource(2);

            outputVideo = Encoding.Default.GetString(tv.Watch());
            Assert.AreEqual(LifeOfBrianBluRay, outputVideo);
        }
Beispiel #3
0
        public void Test1()
        {
            Television Westinghouse = new Television();

            Westinghouse.Brand       = "Westinghouse";
            Westinghouse.Price       = 200.00M;
            Westinghouse.Screen_size = 39.5F;
            Westinghouse.Technology  = "LED";
            Westinghouse.Condition   = "used";
            Westinghouse.Model       = "UW40TA2W";
            Inventory.Add(Westinghouse);


            BluRayPlayer SamsungBD = new BluRayPlayer();

            SamsungBD.Brand     = "Samsung";
            SamsungBD.Model     = "BD-F5900";
            SamsungBD.Price     = 127.99M;
            SamsungBD.Condition = "new";
            SamsungBD.addFeature("Smart");
            Inventory.Add(SamsungBD);


            Laptop Acer = new Laptop();

            Acer.Brand     = "Acer";
            Acer.Model     = "4730z Aspire";
            Acer.Price     = 250.00M;
            Acer.Condition = "new";
            Acer.addFeature("SSD");
            Inventory.Add(Acer);


            Cellphone metro = new Cellphone();

            metro.Brand            = "Samsung Admire";
            metro.Model            = "SCH-R720";
            metro.Price            = 39.99M;
            metro.Condition        = "used";
            metro.service_provider = "Metro PCS";
            Inventory.Add(metro);

            ElectronicGroomer razor = new ElectronicGroomer();

            razor.Brand     = "Phillips Norelco Shaver";
            razor.Model     = "PT724/41";
            razor.Price     = 39.95M;
            razor.Condition = "new";
            Inventory.Add(razor);


            //Powering On All Devices
            foreach (Electronic device in Inventory)
            {
                ResultsBox.Items.Add(device.powerOn());
            }
            ResultsBox.Items.Add("");
            ResultsBox.Items.Add(razor.powerOn());


            //Performing a Phone Call on capable devices
            foreach (Electronic device in Inventory)
            {
                if (device is ICall)
                {
                    ResultsBox.Items.Add((device as ICall).call(7703458888));
                }
            }

            //Powering Off all Devices
            foreach (Electronic device in Inventory)
            {
                ResultsBox.Items.Add(device.powerOff());
            }

            //Charging devices that are chargeable
            foreach (Electronic device in Inventory)
            {
                if (device is ICharge)
                {
                    ResultsBox.Items.Add((device as ICharge).charge(3));
                }
            }
        }