示例#1
0
        public void Test1()
        {
            var result = RansomNote.checkMagazine(
                new[] { "give", "me", "one", "grand", "today", "night" },
                new[] { "give", "one", "grand", "today" });

            Assert.True(result);

            result = RansomNote.checkMagazine(
                new[] { "not", "enough", "Words" },
                new[] { "not", "enough", "words" });

            Assert.False(result);
        }
示例#2
0
        public void Run()
        {
            PrintProblem();

            Console.WriteLine("words on magazine: number of words on note:");
            a = System.Array.ConvertAll(Console.ReadLine().Split(' '), aTemp => Convert.ToInt64(aTemp));
            Console.WriteLine("Magazine:");
            d = Console.ReadLine().Split(' ');
            Console.WriteLine("Note:");
            e = Console.ReadLine().Split(' ');

            string result = RansomNote.checkMagazine(d, e);

            Console.WriteLine();
            Console.WriteLine("Result:");
            Console.WriteLine(result);
            Console.ReadKey();
        }
示例#3
0
        public void RansomNoteTest5()
        {
            string[] magazine = { "there", "was",  "a",    "bird",    "in",   "my",      "bedroom",
                                  "and",   "I",    "must", "tell",    "you",  "without",
                                  "a",     "word", "of",   "doubt",   "that", "the",
                                  "bird",  "is",   "the",  "biggest", "bird", "I",       "have",
                                  "ever",  "seen" };

            string[] note = { "the",
                              "bird",
                              "is",
                              "the",
                              "word" };

            string result = RansomNote.checkMagazine(magazine, note);

            Assert.AreEqual("Yes", result);
        }
示例#4
0
        public void RansomNoteTest4()
        {
            string[] magazine = { "give",
                                  "me",
                                  "one",
                                  "grand",
                                  "today",
                                  "night" };

            string[] note = { "Give",
                              "one",
                              "grand",
                              "today" };

            string result = RansomNote.checkMagazine(magazine, note);

            Assert.AreEqual("No", result);
        }
示例#5
0
        public void RansomNoteTest3()
        {
            string[] magazine = { "ive",
                                  "got",
                                  "a",
                                  "lovely",
                                  "bunch",
                                  "of",
                                  "coconuts" };

            string[] note = { "ive",
                              "got",
                              "some",
                              "coconuts" };

            string result = RansomNote.checkMagazine(magazine, note);

            Assert.AreEqual("No", result);
        }
示例#6
0
        public void RansomNoteTest2()
        {
            string[] magazine = { "two",
                                  "times",
                                  "three",
                                  "is",
                                  "not",
                                  "four" };

            string[] note = { "two",
                              "times",
                              "two",
                              "is",
                              "four" };

            string result = RansomNote.checkMagazine(magazine, note);

            Assert.AreEqual("No", result);
        }