コード例 #1
0
        public void TestMethod1()
        {
            Greeter greeter = new Greeter();

            greeter.SayHello("Aaron");
            string greeting = greeter.GetRandomGreeting().ToLower();

            greeting = "Random greeting: " + greeting;
            greeter.SaySomething(greeting);

            greeter.SaySomething(greeter.GetRandomGreeting());
        }
コード例 #2
0
        public void TestMethod1()
        {
            Greeter greeter = new Greeter();

            //1 - this is an argument, whereas in the class itself, it is called a parameter
            //                  1
            greeter.SayHello("Evan");

            string greeting = greeter.GetRandomGreeting().ToLower();

            greeting = "Random Greeting: " + greeting;
            greeter.SaySomething(greeting);
        }
コード例 #3
0
        public void GreeterMethodsTests()
        {
            Greeter greeterInstance = new Greeter();

            greeterInstance.SayHello("Brad");

            List <string> students = new List <string>();

            students.Add("Hannah");
            students.Add("Joel");
            students.Add("Jay");
            students.Add("Lauren");
            students.Add("Luis");

            foreach (string student in students)
            {
                greeterInstance.SayHello(student);
            }


            string greeting = greeterInstance.GetRandomGreeting();

            Console.WriteLine(greeting);
        }