Exemplo n.º 1
0
 public void SampleTest()
 {
     Assert.AreEqual("no one likes this", WhoLikesIt.Likes(new string[0]));
     Assert.AreEqual("Peter likes this", WhoLikesIt.Likes(new string[] { "Peter" }));
     Assert.AreEqual("Jacob and Alex like this", WhoLikesIt.Likes(new string[] { "Jacob", "Alex" }));
     Assert.AreEqual("Max, John and Mark like this", WhoLikesIt.Likes(new string[] { "Max", "John", "Mark" }));
     Assert.AreEqual("Alex, Jacob and 2 others like this", WhoLikesIt.Likes(new string[] { "Alex", "Jacob", "Mark", "Max" }));
 }
Exemplo n.º 2
0
        public void FourNameTest()
        {
            // 4 names
            Assert.AreEqual(WhoLikesIt.Likes(names.Take(4).ToArray()), WhoLikesIt.Likes(names.Take(4).ToArray()));

            const int Tests = 1000;

            for (int i = 0; i < Tests; ++i)
            {
                names = names.OrderBy(_ => rnd.Next()).ToArray();
                string[] test = names.Take(rnd.Next(0, 101)).ToArray();

                string expected = WhoLikesIt.Likes(test);
                string actual   = WhoLikesIt.Likes(test);

                Assert.AreEqual(expected, actual);
            }
        }
Exemplo n.º 3
0
 public void ThreeNameTest()
 {
     Assert.AreEqual(WhoLikesIt.Likes(names.Take(3).ToArray()), WhoLikesIt.Likes(names.Take(3).ToArray()));
 }
Exemplo n.º 4
0
 public void ZeroNameTest()
 {
     Assert.AreEqual(WhoLikesIt.Likes(new string[0]), WhoLikesIt.Likes(new string[0]));
 }