示例#1
0
        private static void Main(string[] args)
        {
            // Part 1
            Santa santa = new Santa();
            List<string> list = File.ReadAllLines("input.txt").ToList();
            int niceStrings = list.Count(x => santa.IsNiceString(x));
            Console.WriteLine(
                $"Part One: {list.Count} strings processed. {list.Count - niceStrings} strings marked as naughty. {niceStrings} strings are nice");

            // Part 2
            niceStrings = list.Count(x => santa.IsNiceString2(x));
            Console.WriteLine(
                $"Part Two: {list.Count} strings processed. {list.Count - niceStrings} strings marked as naughty. {niceStrings} strings are nice");
            Console.Write("Press any key...");
            Console.ReadKey();
        }
 public void ValidateThreeVowels()
 {
     Santa santa = new Santa();
     bool actual = santa.IsNiceString("aaa");
     Assert.AreEqual(true, actual);
 }
 public void ValidateNiceString()
 {
     Santa santa = new Santa();
     bool actual = santa.IsNiceString("ugknbfddgicrmopn");
     Assert.AreEqual(true, actual);
 }
 public void ValidateNaughtyOneVowel()
 {
     Santa santa = new Santa();
     bool actual = santa.IsNiceString("dvszwmarrgswjxmb");
     Assert.AreEqual(false, actual);
 }
 public void ValidateNaughtyNoDouble()
 {
     Santa santa = new Santa();
     bool actual = santa.IsNiceString("jchzalrnumimnmhp");
     Assert.AreEqual(false, actual);
 }
 public void ValidateNaughtyBadString()
 {
     Santa santa = new Santa();
     bool actual = santa.IsNiceString("haegwjzuvuyypxyu");
     Assert.AreEqual(false, actual);
 }