protected override void PerfomAction()
        {
            var builder  = new HighEndComputerBuilder();
            var director = new ComputerDirector();

            director.MakeComputer(builder);

            var computer = builder.Computer;

            Console.WriteLine(computer);
        }
Beispiel #2
0
        public void TestHighEndBuilderConstruction()
        {
            //Initialize the builder
            var highEndBuilder = new HighEndComputerBuilder();

            //Tell the director to construct the builder
            //No exceptions should occure while building the computer since the components are hardcoded by the developer
            ComputerDirector.Construct(highEndBuilder);

            //Check each component of the Computer object to ensure that no components are missing and were successfully initialized
            Assert.IsNotNull(highEndBuilder.Computer.Motherboard);
            Assert.IsNotNull(highEndBuilder.Computer.HardDrive);
            Assert.IsNotNull(highEndBuilder.Computer.Case);
        }