Exemplo n.º 1
0
        static void Main(string[] args)
        {
            HomeStead home    = new HomeStead("Zuma", "Wierda", "Gauteng", "ZA");
            Nkandla   nkandla = new Nkandla("Zuma", "Wierda", "Gauteng", "ZA");

            string temp = "HomeStead:" + " Name { Zuma } District { Wierda } Province { Gauteng } Country { ZA }";

            if (temp.Equals(home.ToString()))
            {
                Console.WriteLine("HomeStead initiated correctly done");
            }

            Politician JacobZuma    = new Politician("Jacob Zuma", 43, Gender.MALE, PersonType.President, PartyType.ANC);
            Politician HelenZille   = new Politician("Hellen Zille", 50, Gender.FEMALE, PersonType.Politician, PartyType.DA);
            Politician JuliusMalema = new Politician("Julius Malema", 38, Gender.MALE, PersonType.Politician, PartyType.EFF);

            Lawer     BarryRoux  = new Lawer("Barry Roux", 55, Gender.MALE, PersonType.Lawyer, PartyType.ANC);
            Architect GregWright = new Architect("Greg Wright", 62, Gender.MALE, PersonType.Architect, PartyType.ANC);

            Console.WriteLine(JacobZuma.ToString());
            Console.WriteLine(HelenZille.ToString());
            Console.WriteLine(JuliusMalema.ToString());
            Console.WriteLine(BarryRoux.ToString());
            Console.WriteLine(GregWright.ToString());

            home.accept(HelenZille);
            home.accept(JuliusMalema);
            home.accept(JacobZuma);

            Console.Read();
        }
Exemplo n.º 2
0
 public void initialise()
 {
     _nkandla          = new Nkandla();
     _nkandla.Name     = "Nkandla";
     _nkandla.Country  = "South Africa";
     _nkandla.District = "WhoKnowsWhere";
 }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            HomeStead home    = new HomeStead("Zuma", "Wierda", "Gauteng", "ZA");
            Nkandla   nkandla = new Nkandla("Zuma", "Wierda", "Gauteng", "ZA");

            //Testing
            string temp = "HomeStead:" + " Name [Zuma] District [Wierda] Province [Gauteng] Country [ZA]";

            if (temp.Equals(home.ToString()))
            {
                Console.WriteLine("HomeStead initiated correct");
            }

            ChickenRun chickens = new ChickenRun();

            chickens.NumerOfChickens = 50;

            SwimmingPool firePool = new SwimmingPool();

            firePool.Height = 100;
            firePool.Width  = 75;

            Amphitheatre amphi = new Amphitheatre();

            amphi.NumberOfSeats = 5000;

            nkandla.ChickenRun   = chickens;
            nkandla.SwimmingPool = firePool;
            nkandla.Amphitheatre = amphi;

            //Testing the properties of Nkandla
            Console.WriteLine("Nkandla ChickenRun: NumberOfChickens = " + chickens.NumerOfChickens);
            Console.WriteLine("Nkandla SwimmingPool: Width = " + firePool.Width + " Height: " + firePool.Height);
            Console.WriteLine("Nkandla Amphitheatre: NumberOfSeats = " + amphi.NumberOfSeats);

            Politician JacobZuma    = new Politician("Jacob Zuma", 43, Gender.MALE, PersonType.President, PartyType.ANC);
            Politician HelenZille   = new Politician("Hellen Zille", 50, Gender.FEMALE, PersonType.Politician, PartyType.DA);
            Politician JuliusMalema = new Politician("Julius Malema", 38, Gender.MALE, PersonType.Politician, PartyType.EFF);

            Lawer     BarryRoux  = new Lawer("Barry Roux", 55, Gender.MALE, PersonType.Lawyer, PartyType.ANC);
            Architect GregWright = new Architect("Greg Wright", 62, Gender.MALE, PersonType.Architect, PartyType.ANC);

            //Output
            Console.WriteLine(JacobZuma.ToString());
            Console.WriteLine(HelenZille.ToString());
            Console.WriteLine(JuliusMalema.ToString());
            Console.WriteLine(BarryRoux.ToString());
            Console.WriteLine(GregWright.ToString());

            home.accept(HelenZille);
            home.accept(JuliusMalema);
            home.accept(JacobZuma);


            Console.Read();
        }
        public void VisitTest()
        {
            HomeStead homestead = new Nkandla();

            homestead.Name = "Nkandla";

            var stdOut = Console.Out;
            var output = new StringWriter();

            Console.SetOut(output);

            _politician.visit(homestead);

            Console.SetOut(stdOut);

            Assert.AreEqual("A Jerk is now visiting the Nkandla home stead\r\n", output.ToString());
        }
Exemplo n.º 5
0
        static void Main(string[] args)
        {
            Politician helen  = new Politician("Helen Zille", 50, Gender.Female, "DA");
            Politician julius = new Politician("Julius Malema", 55, Gender.Male, "EFF");
            Politician jacob  = new Politician("Jacob Zuma", 70, Gender.Male, "ANC");

            HomeStead nkandla = new Nkandla("Nkandla", "uThungulu", "KwaZulu-Natal", "South Africa");

            try
            {
                nkandla.accept(helen);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            try
            {
                nkandla.accept(jacob);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            try
            {
                nkandla.accept(julius);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            Console.ReadLine();
        }