Exemplo n.º 1
0
        public void RandomTest()
        {
            for (int i = 0; i < 100; ++i)
            {
                string[] name = new string[rnd.Next(1, 6)];
                for (int j = 0; j < name.Length; ++j)
                {
                    int    l = rnd.Next(3, 12);
                    string n = "";
                    for (int k = 0; k < l; ++k)
                    {
                        n += chars[rnd.Next(0, chars.Length)];
                    }
                    name[j] = n;
                }

                string city   = "";
                string state  = "";
                int    length = rnd.Next(3, 12);
                for (int j = 0; j < length; ++j)
                {
                    city  += chars[rnd.Next(0, chars.Length)];
                    state += chars[rnd.Next(0, chars.Length)];
                }

                string expected = solution(name, city, state);
                string actual   = WelcomeToCity.SayHello(name, city, state);
                Assert.AreEqual(expected, actual);
            }
        }
Exemplo n.º 2
0
 public void FixedTest(string[] name, string city, string state, string expected)
 {
     Assert.AreEqual(expected, WelcomeToCity.SayHello(name, city, state));
 }
Exemplo n.º 3
0
 public void SampleTest()
 {
     Assert.AreEqual("Hello, John Smith! Welcome to Phoenix, Arizona!", WelcomeToCity.SayHello(new string[] { "John", "Smith" }, "Phoenix", "Arizona"));
 }