Exemplo n.º 1
0
        public void TestMethod2()
        {
            IHumanFactory maleFactory   = new MaleFactory();
            IHumanFactory femaleFactory = new FemaleFactory();

            IHuman maleWhiteHuman   = maleFactory.CreateWhiteHuman();
            IHuman femaleWhiteHuman = femaleFactory.CreateWhiteHuman();

            maleWhiteHuman.GetSex();
            maleWhiteHuman.Move();

            femaleWhiteHuman.GetSex();
            femaleWhiteHuman.Move();

            IHuman maleBlackHuman   = maleFactory.CreateBlackHuman();
            IHuman femaleBlackHuman = femaleFactory.CreateBlackHuman();

            maleBlackHuman.GetSex();
            maleBlackHuman.Move();
            femaleBlackHuman.GetSex();
            femaleBlackHuman.Move();
            //Output:
//            White Human, I 'am Men
//White Person is Moving
//White Human, I 'am Women
//White Person is Moving
//Black Human, I 'am Men
//Black Person is Moving
//Black Human, I 'am Women
//Black Person is Moving
        }