Esempio n. 1
0
            void AnnounceInsideFactory(ShipmentUnloadedFromCargoBay e)
            {
                _shipmentsWaitingToBeUnloaded.Remove(e.CarParts);

                // should this be here? It feels inappropriate.
                // what if it's not internal state but an external component (service) that should be notified?
                _carpartsInStock.Add(e.CarParts);
            }
Esempio n. 2
0
            // Homework
            void AnnounceInsideFactory(ShipmentUnloadedFromCargoBay e)
            {
                // TODO:  See Inventory refactoring notes above.
                // Rule: when we unload shipments from cargo bay then all shipments that are already
                // stored in the cargo bay are considered unloaded
                // this means that they are available to the factory for use in the production of cars.
                // This means that all the parts added to
                // _shipmentsWaitingToBeUnloaded by the ShipmentTransferredToCargoBay event are now 100%
                // available for use.

                // We do NOT want to clear this list in this example because it BECOMES
                // the available inventory.
                // TODO: Should probably use diff vars to represent
                // "stuff waiting to be unloaded" vs "stuff that has been unloaded"
                // _shipmentsWaitingToBeUnloaded.Clear();

                // Can uncomment line below to test that cars can't be built
                // without inventory of parts
                // _shipmentsWaitingToBeUnloaded.Clear();

                // Rule: an employee can only unload the cargo bay once a day
                // so remember who just did it

                _employeesWhoHaveUnloadedCargoBayToday.Add(e.EmployeeName);
            }