示例#1
0
        private static void CreateSecondOrder()
        {
            Singleton.Singleton receipt = Singleton.Singleton.GetInstance();
            Client client = new Client(new JpFactory());

            receipt.AddToHistory(client.Soup.ToString());
            receipt.AddToHistory(client.MainCourse.ToString());
            receipt.AddToHistory();
        }
示例#2
0
        private static void CreateThirdOrder()
        {
            Singleton.Singleton receipt = Singleton.Singleton.GetInstance();
            Client client = new Client(new ItFactory());

            receipt.AddToHistory(client.Drink.ToString());
            receipt.AddToHistory(client.Drink.ToString());
            receipt.AddToHistory(client.Drink.ToString());
            receipt.AddToHistory();
        }
示例#3
0
        static void Main(string[] args)
        {
            Singleton.Singleton receipt = Singleton.Singleton.GetInstance();
            CreateFirstOrder();
            CreateSecondOrder();
            CreateThirdOrder();

            foreach (string s in receipt.History)
            {
                Console.WriteLine(s);
            }
            Console.ReadKey();
        }