Ejemplo n.º 1
0
        public static void Start()
        {
            // instantiate components here
            Amplifier amp = new Amplifier();

            Tuner     tuner = new Tuner(amp);
            DvdPlayer dvd   = new DvdPlayer(amp);
            CdPlayer  cd    = new CdPlayer(amp);

            amp.SetCd(cd);
            amp.SetDvd(dvd);
            amp.SetTuner(tuner);

            Projector     projector = new Projector(dvd);
            Screen        screen    = new Screen();
            TheaterLights lights    = new TheaterLights();
            PopcornPopper popper    = new PopcornPopper();


            HomeTheaterFacade homeTheater = new HomeTheaterFacade(
                amp, cd, dvd, popper,
                projector, screen, lights, tuner
                );

            homeTheater.WatchMovie("Matrix Reloaded");
            homeTheater.EndMovie();
        }
        public static void Run()
        {
            var homeTheater = new HomeTheaterFacade(new Amplifier(), new MyTuner(), new DvdPlayer(), new CdPlayer(), new Projector(), new TheaterLights(), new Screen(), new PopcornPopper());

            homeTheater.WatchMovie("Interestellar");
            homeTheater.EndMovie();
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            //var duck = new MallardDuck();

            //var turkey = new WildTurkey();
            //IDuck turkeyAdapter = new TurkeyAdapter(turkey);

            //Console.WriteLine("The turkey says...");
            //turkey.Gobble();
            //turkey.Fly();

            //Console.WriteLine("\nThe duck says...");
            //TestTheDuck(duck);

            //Console.WriteLine("\nThe turkeyAdapter says...");
            //TestTheDuck(turkeyAdapter);

            var amp       = new Amplifier();
            var tuner     = new Tuner();
            var dvd       = new DvdPlayer();
            var cd        = new CdPlayer();
            var projector = new Projector();
            var screen    = new Screen();
            var lights    = new TheaterLights();
            var popper    = new PopcornPopper();

            var homeTheater = new HomeTheaterFacade(amp, tuner, dvd, cd, projector, lights, screen, popper);

            homeTheater.WatchMovie("Raiders of the Lost Ark");
            homeTheater.EndMovie();

            Console.ReadKey();
        }
Ejemplo n.º 4
0
        public void TestHomeTheaterMovie()
        {
            expectedWatchMovieOutput.Append("Get ready to watch a movie...\n");
            expectedWatchMovieOutput.Append("Popcorn Popper on\n");
            expectedWatchMovieOutput.Append("Popcorn Popper popping popcorn!\n");
            expectedWatchMovieOutput.Append("Theater Ceiling Lights dimming to 10%\n");
            expectedWatchMovieOutput.Append("Theater Screen going down\n");
            expectedWatchMovieOutput.Append("Top-O-Line Projector on\n");
            expectedWatchMovieOutput.Append("Top-O-Line Projector in widescreen mode (16x9 aspect ratio)\n");
            expectedWatchMovieOutput.Append("Top-O-Line Amplifier on\n");
            expectedWatchMovieOutput.Append("Top-O-Line Amplifier setting DVD player to Top-O-Line DVD Player\n");
            expectedWatchMovieOutput.Append("Top-O-Line Amplifier surround sound on (5 speakers, 1 subwoofer)\n");
            expectedWatchMovieOutput.Append("Top-O-Line Amplifier setting volume to 5\n");
            expectedWatchMovieOutput.Append("Top-O-Line DVD Player on\n");
            expectedWatchMovieOutput.Append("Top-O-Line DVD Player playing \"Toy Story\"\n");

            expectedEndMovieOutput.Append("Shutting movie theater down...\n");
            expectedEndMovieOutput.Append("Popcorn Popper off\n");
            expectedEndMovieOutput.Append("Theater Ceiling Lights on\n");
            expectedEndMovieOutput.Append("Theater Screen going up\n");
            expectedEndMovieOutput.Append("Top-O-Line Projector off\n");
            expectedEndMovieOutput.Append("Top-O-Line Amplifier off\n");
            expectedEndMovieOutput.Append("Top-O-Line DVD Player stopped \"Toy Story\"\n");
            expectedEndMovieOutput.Append("Top-O-Line DVD Player eject\n");
            expectedEndMovieOutput.Append("Top-O-Line DVD Player off\n");

            Assert.AreEqual(expectedWatchMovieOutput.ToString(),
                            homeTheater.WatchMovie("Toy Story"));
            Assert.AreEqual(expectedEndMovieOutput.ToString(),
                            homeTheater.EndMovie());
        }
Ejemplo n.º 5
0
        static void Main(string[] args)
        {
            HomeTheaterFacade theaterFacade = new HomeTheaterFacade(new Amplifier(), new Tuner(), new DvdPlayer(), new CdPlayer(),
                                                                    new Projector(), new TheaterLights(), new Screen(), new PopcornPopper());

            theaterFacade.WachtMovie("Meia-noite em Paris");
            theaterFacade.EndMovie();
        }
        public void ShouldWatchMovie()
        {
            var homeTheater = new HomeTheaterFacade(new Amplifier(), new DvdPlayer(), new Projector(),
                                                    new TheaterLights(), new Screen(), new PopcornPopper());

            homeTheater.WatchMovie("The Shawshank Redemption");
            homeTheater.EndMovie();
        }
Ejemplo n.º 7
0
        static void Main(string[] args)
        {
            var facade = new HomeTheaterFacade(new Amplifier(), new DvdPlayer(), new Projector(), new TheaterLights(), new Screen(), new PopcornPopper());

            facade.WatchMovie("Ready Player One");
            facade.EndMovie();

            Console.ReadKey();
        }
Ejemplo n.º 8
0
        private static void Main(string[] args)
        {
            Console.WriteLine("Sendo adaptavel!");

            HomeTheaterFacade homeTheater = new HomeTheaterFacade(new Amplifier(), new Tuner(), new DvdPlayer(), new CdPlayer(), new Projetor(), new TheaterLights(), new Screen(), new PopcornPopper());

            homeTheater.WatchMovie("Aladim");
            homeTheater.EndMovie();
        }
Ejemplo n.º 9
0
        static void Facade()
        {
            Screen            screen    = new Screen();
            Tuner             tuner     = new Tuner();
            DVDPlayer         dvdplayer = new DVDPlayer();
            Popcorn           popcorn   = new Popcorn();
            Amplifier         amp       = new Amplifier();
            HomeTheaterFacade facade    = new HomeTheaterFacade(screen, tuner, dvdplayer, popcorn, amp);

            facade.WatchMovie();
            Console.WriteLine();
            facade.EndMovie();
        }
Ejemplo n.º 10
0
    static void Main()
    {
        Amplifier     amp       = new Amplifier();
        Tuner         tuner     = new Tuner();
        DvdPlayer     dvd       = new DvdPlayer();
        CdPlayer      cd        = new CdPlayer();
        Projector     projector = new Projector();
        Screen        screen    = new Screen();
        TheaterLights lights    = new TheaterLights();
        PopcornPopper popper    = new PopcornPopper();

        HomeTheaterFacade homeTheater = new HomeTheaterFacade(amp, tuner, dvd, cd, projector, screen, lights, popper);

        homeTheater.WatchMovie("Raiders of the Lost Ark");
        homeTheater.EndMovie();
    }
Ejemplo n.º 11
0
        static void Main(string[] args)
        {
            IDvdPlayer   dvdPlayer   = new DvdPlayer();
            ICdPlayer    cdPlayer    = new CdPlayer();
            IAmplifier   amplifier   = new Amplifier();
            IProjector   projector   = new Projector();
            IHomeTheater homeTheater = new HomeTheaterFacade(projector, amplifier, dvdPlayer, cdPlayer);

            homeTheater.WatchMovie("Finding Nemo");
            homeTheater.EndMovie();

            homeTheater.PlayMusic("Beethoven Symphonie Number 6");
            homeTheater.StopMusic();

            Console.ReadKey();
        }
Ejemplo n.º 12
0
        private static void TestFacadePattern()
        {
            string        brand = "Top-O-Line";
            Amplifier     a     = new Amplifier(brand);
            Tuner         t     = new Tuner();
            DvdPlayer     d     = new DvdPlayer(brand);
            CdPlayer      c     = new CdPlayer(brand);
            Projector     p     = new Projector(brand);
            Screen        s     = new Screen();
            TheaterLights l     = new TheaterLights();
            PopcornPopper pp    = new PopcornPopper();

            HomeTheaterFacade homeTheater = new HomeTheaterFacade(a, t, d, c, p, s, l, pp);

            Console.WriteLine(homeTheater.WatchMovie("Black Panther"));
            Console.WriteLine(homeTheater.EndMovie());
        }
        public static void Test()
        {
            var amp       = new Amplifier();
            var tuner     = new Tuner();
            var dvd       = new DvdPlayer();
            var cd        = new CdPlayer();
            var projector = new Projector();
            var screen    = new Screen();
            var lights    = new TheaterLights();
            var popper    = new PopcornPopper();

            var homeTheaterFacade = new HomeTheaterFacade(
                amp, tuner, dvd, cd, projector, screen, lights, popper
                );

            homeTheaterFacade.WatchMovie("Raiders of the Lost Ark");
            homeTheaterFacade.EndMovie();
        }
Ejemplo n.º 14
0
        public void FacadeTest()
        {
            Amplifier     amp       = new Amplifier("Top-O-Line Amplifier");
            Tuner         tuner     = new Tuner("Top-O-Line AM/FM Tuner", amp);
            DvdPlayer     dvd       = new DvdPlayer("Top-O-Line DVD Player", amp);
            CdPlayer      cd        = new CdPlayer("Top-O-Line CD Player", amp);
            Projector     projector = new Projector("Top-O-Line Projector", dvd);
            TheaterLights lights    = new TheaterLights("Theater Ceiling Lights");
            Screen        screen    = new Screen("Theater Screen");
            PopcornPopper popper    = new PopcornPopper("Popcorn Popper");

            HomeTheaterFacade homeTheater =
                new HomeTheaterFacade(amp, tuner, dvd, cd,
                                      projector, screen, lights, popper);

            homeTheater.WatchMovie("Raiders of the Lost Ark");
            homeTheater.EndMovie();
        }
Ejemplo n.º 15
0
        static void Main(string[] args)
        {
            var amp       = new Amplifier();
            var tuner     = new Tuner();
            var dvd       = new DvdPlayer();
            var cd        = new CdPlayer();
            var projector = new Projector();
            var screen    = new Screen();
            var lights    = new TheaterLights();
            var popper    = new PopcornPopper();

            HomeTheaterFacade homeTheater = new HomeTheaterFacade(amp, tuner, dvd, cd, projector, screen, lights, popper);

            homeTheater.WatchMovie("Raiders of the Lost Ark");
            homeTheater.EndMovie();

            Console.ReadKey();
        }
Ejemplo n.º 16
0
        public string Get(int id)
        {
            // return "value";
            Amplifier baseAmplifier = new Amplifier();

            Tuner     tuner    = new Tuner(baseAmplifier);
            DvdPlayer dvd      = new DvdPlayer(baseAmplifier);
            CdPlayer  cdPlayer = new CdPlayer(baseAmplifier);

            Amplifier         amp    = new Amplifier(tuner, dvd, cdPlayer);
            HomeTheaterFacade facade = new HomeTheaterFacade(amp, tuner, dvd, cdPlayer, new Projector(dvd), new Screen(),
                                                             new TheaterLights(), new Popper());

            if (id % 2 == 0)
            {
                return(facade.WatchMovie("Raiders"));
            }
            else
            {
                return(facade.EndMovie());
            }
        }