Exemplo n.º 1
0
        static void Main(string[] args)
        {
            String projDir = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.FullName;
            String path    = projDir + "\\testing-config.txt";

            System.IO.StreamReader file = new System.IO.StreamReader(path);

            String        line;
            List <String> testingInputs = new List <String>();

            while ((line = file.ReadLine()) != null)
            {
                testingInputs.Add(line.Trim());
            }
            file.Close();

            foreach (String test in testingInputs)
            {
                IGUIfactory factory = null;

                switch (test)
                {
                case "Word00":
                    factory = Word00Factory.getInstance();
                    break;

                case "Word10":
                    factory = Word10Factory.getInstance();
                    break;

                case "Word18":
                    factory = Word18Factory.getInstance();
                    break;

                case "Word90":
                    factory = Word90Factory.getInstance();
                    break;

                default:
                    Console.WriteLine("line not recognized");
                    break;
                }

                if (factory != null)
                {
                    IButton  button  = factory.createButton();
                    IPanel   panel   = factory.createPanel();
                    ITextbox textbox = factory.createTextbox();

                    Console.WriteLine("Testing " + test + ":" + button.getDescription() + ", " + panel.getDescription() + ", " + textbox.getDescription());
                }
                else
                {
                }
            }


            // pause
            Console.ReadKey();
        }
Exemplo n.º 2
0
        public static Word18Factory getInstance()
        {
            if (instances == null)
            {
                instances = new List <Word18Factory>();

                Word18Factory instance1 = new Word18Factory();
                instances.Add(instance1);

                return(instance1);
            }
            else if (instances.Count < 2)
            {
                Word18Factory instance2 = new Word18Factory();
                instances.Add(instance2);

                return(instance2);
            }
            else
            {
                Console.WriteLine("Warning: Already two instances of Word18. Returning first instance.");
                return(instances[0]);
            }
        }