Beispiel #1
0
        // let's run this implementation3 of the factory
        // (right-click on this project in Visual Studio and choose "set as StartUp project"
        // then push Ctrl+F5 to see this implementation of factory 3 running inside the console)
        static void Main(string[] args)
        {
            Print("A new day at the factory starts...\r\n");
            var factory = new FactoryImplementation3();

            factory.TransferShipmentToCargoBay("chassis", new[]
                {
                    new CarPart("chassis", 4),
                });

            factory.AssignEmployeeToFactory("yoda");
            factory.AssignEmployeeToFactory("luke");
            // Hmm, a duplicate employee name, wonder if that will work?
            factory.AssignEmployeeToFactory("yoda");
            // An employee named "bender", why is that ringing a bell?
            factory.AssignEmployeeToFactory("bender");

            factory.TransferShipmentToCargoBay("model T spare parts", new[]
                {
                    new CarPart("wheels", 20),
                    new CarPart("engine", 7),
                    new CarPart("bits and pieces", 2)
                });

            Print("\r\nIt's the end of the day. Let's read our journal of events once more:\r\n");
            Print("\r\nWe should only see events below that were actually allowed to be recorded.\r\n");
            foreach (var e in factory.JournalOfFactoryEvents)
            {
                Print("!> {0}", e);
            }

            Print("\r\nIt seems, this was an interesting day!  Two Yoda's there should be not!");
            Console.ReadLine();
        }
Beispiel #2
0
        // let's run this implementation3 of the factory
        // (right-click on this project in Visual Studio and choose "set as StartUp project"
        // then push Ctrl+F5 to see this implementation of factory 3 running inside the console)

        static void Main(string[] args)
        {
            Print("A new day at the factory starts...\r\n");
            var factory = new FactoryImplementation3();


            factory.TransferShipmentToCargoBay("chassis", new[]
            {
                new CarPart("chassis", 4),
            });

            factory.AssignEmployeeToFactory("yoda");
            factory.AssignEmployeeToFactory("luke");
            // Hmm, a duplicate employee name, wonder if that will work?
            factory.AssignEmployeeToFactory("yoda");
            // An employee named "bender", why is that ringing a bell?
            factory.AssignEmployeeToFactory("bender");

            factory.TransferShipmentToCargoBay("model T spare parts", new[]
            {
                new CarPart("wheels", 20),
                new CarPart("engine", 7),
                new CarPart("bits and pieces", 2)
            });


            Print("\r\nIt's the end of the day. Let's read our journal of events once more:\r\n");
            Print("\r\nWe should only see events below that were actually allowed to be recorded.\r\n");
            foreach (var e in factory.JournalOfFactoryEvents)
            {
                Print("!> {0}", e);
            }

            Print("\r\nIt seems, this was an interesting day!  Two Yoda's there should be not!");
        }
Beispiel #3
0
        // let's run this implementation
        static void Main(string[] args)
        {
            Print("A new day at the factory starts...\r\n");
            var factory = new FactoryImplementation3();

            factory.TransferShipmentToCargoBay("chassis", new[]
                {
                    new CarPart("chassis", 4),
                });

            factory.AssignEmployeeToFactory("yoda");
            factory.AssignEmployeeToFactory("luke");
            factory.AssignEmployeeToFactory("yoda");
            factory.AssignEmployeeToFactory("bender");

            factory.TransferShipmentToCargoBay("model T spare parts", new[]
                {
                    new CarPart("wheels", 20),
                    new CarPart("engine", 7),
                    new CarPart("bits and pieces", 2)
                });

            Print("\r\nIt's the end of the day. Let's read our journal once more:\r\n");
            foreach (var e in factory.JournalOfFactoryEvents)
            {
                Print("!> {0}", e);
            }

            Print("\r\nIt seems, this was an interesting day!");
        }
Beispiel #4
0
        // let's run this implementation
        public static void RunFactoryImplementation3()
        {
            var factory = new FactoryImplementation3();

            factory.TransferShipmentToCargoBay("chassis", new[]
                {
                    new CarPart("chassis", 4),
                });

            factory.AssignEmployeeToFactory("yoda");
            factory.AssignEmployeeToFactory("luke");
            factory.AssignEmployeeToFactory("yoda");
            factory.AssignEmployeeToFactory("bender");

            factory.TransferShipmentToCargoBay("model T spare parts", new[]
                {
                    new CarPart("wheels", 20),
                    new CarPart("engine", 7),
                    new CarPart("bits and pieces", 2)
                });

            Print("It's the end of the day. Let's see what happened, ok?");
            foreach (var e in factory.JournalOfFactoryEvents)
            {
                Print("!> {0}", e);
            }
        }
        // let's run this implementation3 of the factory
        // (right-click on this project in Visual Studio and choose "set as StartUp project"
        // then push Ctrl+F5 to see this implementation of factory 3 running inside the console)
        static void Main(string[] args)
        {
            Print("A new day at the factory starts...\r\n");
            var factory = new FactoryImplementation3();

            factory.TransferShipmentToCargoBay("chassis", new[]
                {
                    new CarPart("chassis", 4),
                });

            factory.AssignEmployeeToFactory("yoda");
            factory.AssignEmployeeToFactory("luke");
            // Hmm, a duplicate employee name, wonder if that will work?
            factory.AssignEmployeeToFactory("yoda");
            // An employee named "bender", why is that ringing a bell?
            factory.AssignEmployeeToFactory("bender");

            factory.TransferShipmentToCargoBay("model T spare parts", new[]
                {
                    new CarPart("wheels", 20),
                    new CarPart("engine", 7),
                    new CarPart("bits and pieces", 2)
                });

            // Homework:  UnloadShipmentFromCargoBay
            factory.UnloadShipmentFromCargoBay("luke");

            // let's make sure luke isn;t asked to do that again
            factory.UnloadShipmentFromCargoBay("luke");

            factory.ProduceCar("yoda", "Model T");

            // let's make sure you can't build another car model
            factory.ProduceCar("luke", "Model A");

            // let's make sure that make sure employee can't be asked to build 2 cars in one day
            factory.ProduceCar("yoda", "Model T");

            Print("\r\nIt's the end of the day. Let's read our journal of events once more:\r\n");
            Print("\r\nWe should only see events below that were actually allowed to be recorded.\r\n");
            foreach (var e in factory.JournalOfFactoryEvents)
            {
                Print("!> {0}", e);
            }

            Print("\r\nIt seems, this was an interesting day!  Two Yoda's there should be not!");
        }