public void EndingWith_D_FindsAtLeastOnePuzzle(string startConsonant)
 {
     VowelMovement puzzle = new VowelMovement();
     {
         List <VowelMovement> vowelMovements = puzzle.FindPuzzle(startConsonant, "d");
         Assert.LessOrEqual(1, vowelMovements.Count,
                            $"Expected at least one puzzle starting with '{startConsonant}' and ending with 'd'.");
     }
 }
 public void StartingWith_M_FindsAtLeastOnePuzzle(string endConsonant)
 {
     VowelMovement puzzle = new VowelMovement();
     {
         List <VowelMovement> vowelMovements = puzzle.FindPuzzle("m", endConsonant);
         Assert.LessOrEqual(1, vowelMovements.Count,
                            $"Expected at least one puzzle starting with 'm' and ending with '{endConsonant}'.");
     }
 }
            public void Default_ReturnsExpectedString()
            {
                VowelMovement puzzle         = new VowelMovement();
                const string  EXPECTED_TWEET =
                    @"

#HowToPlay: https://t.co/rSa0rUCvRC
";

                Assert.AreEqual(EXPECTED_TWEET, puzzle.GetTweet());
            }
示例#4
0
            public void PopulatedObject_CreatesExpectedFile()
            {
                WeekOfPuzzles weekOfPuzzles = new WeekOfPuzzles {
                    Theme = "WeeklyTheme"
                };
                WordSquare mondayWordSquare = new WordSquare("_____")
                {
                    Clues = new [] { "first clue", "second clue", "third clue", "fourth clue", "fifth clue" },
                    Theme = "Theme"
                };

                mondayWordSquare.SetWordAtIndex("acorn", 0);
                mondayWordSquare.SetWordAtIndex("curio", 1);
                int indexToSet = 2;

                mondayWordSquare.SetWordAtIndex("orals", indexToSet);
                mondayWordSquare.SetWordAtIndex("rille", 3);
                mondayWordSquare.SetWordAtIndex("nosed", 4);

                weekOfPuzzles.MondayWordSquare = mondayWordSquare;

                VowelMovement tuesdayVowelMovementPuzzle = new VowelMovement("The MICE MISS their MOOSE.")
                {
                    InitialConsonant = "m",
                    FinalConsonant   = "s",
                    Theme            = "Theme"
                };

                weekOfPuzzles.TuesdayVowelMovement = tuesdayVowelMovementPuzzle;

                ALittleAlliteration wednesdayAlliterationPuzzle = new ALittleAlliteration()
                {
                    Clue     = "Convey vegetable automobile",
                    Solution = "carry carrot car",
                    Theme    = "VegetableWeek"
                };

                weekOfPuzzles.WednesdayALittleAlliteration = wednesdayAlliterationPuzzle;


                string fileName = $"EmptyObject_example_{Process.GetCurrentProcess().Id}.xml";

                if (File.Exists(fileName))
                {
                    File.Delete(fileName);
                }
                weekOfPuzzles.Serialize(fileName);

                var actualText = File.ReadAllText(fileName);

                Console.WriteLine(actualText);
                Assert.AreEqual(EXPECTED_TEXT, actualText);
            }
            public void R_D_FindsExpectedPuzzle()
            {
                VowelMovement        puzzle         = new VowelMovement();
                List <VowelMovement> vowelMovements = puzzle.FindPuzzle("r", "d");

                Assert.IsNotEmpty(vowelMovements);
                puzzle = vowelMovements[0];
                // ReSharper disable StringLiteralTypo
                Assert.AreEqual("It's * to just * away in your * sports car after you * my refridgerator.", puzzle.Clue);
                Assert.AreEqual("It's RUDE to just RIDE away in your RED sports car after you RAID my refridgerator.", puzzle.Solution);
                // ReSharper restore StringLiteralTypo
            }
            public void Example_ReturnsExpectedString()
            {
                VowelMovement puzzle = new VowelMovement
                {
                    Clue = "Each morning I have * * muffins with a cup of weak * because it's good for my *."
                };
                const string EXPECTED_TWEET =
                    @"Each morning I have * * muffins with a cup of weak * because it's good for my *.

#HowToPlay: https://t.co/rSa0rUCvRC
";

                Assert.AreEqual(EXPECTED_TWEET, puzzle.GetTweet());
            }
            public void BR_K_FindsExpectedPuzzle()
            {
                VowelMovement        puzzle         = new VowelMovement();
                List <VowelMovement> vowelMovements = puzzle.FindPuzzle("Br", "k");
                bool foundExpectedPuzzle            = false;

                foreach (var foundPuzzle in vowelMovements)
                {
                    if (foundPuzzle.Solution == "As the storm BROKE over the BROOK, I had to BRAKE before my car hydroplaned out of control.")
                    {
                        foundExpectedPuzzle = true;
                        break;
                    }
                }
                Assert.IsTrue(foundExpectedPuzzle, "Did not find expected puzzle.");
            }
            public void C_L_FindsExpectedPuzzle()
            {
                VowelMovement        puzzle                = new VowelMovement();
                List <VowelMovement> vowelMovements        = puzzle.FindPuzzle("c", "l");
                bool foundPuzzleThatShouldHaveBeenExcluded = false;

                foreach (var foundPuzzle in vowelMovements)
                {
                    if (foundPuzzle.Solution == "I knew someone was trying to KILL me when I found a lump of COAL in my KALE, so I had to CALL the cops.")
                    {
                        foundPuzzleThatShouldHaveBeenExcluded = true;
                        break;
                    }
                }
                Assert.IsTrue(foundPuzzleThatShouldHaveBeenExcluded);
            }
            public void L_K_FindsExpectedPuzzle()
            {
                VowelMovement        puzzle                = new VowelMovement();
                List <VowelMovement> vowelMovements        = puzzle.FindPuzzle("l", "k");
                bool foundPuzzleThatShouldHaveBeenExcluded = false;

                foreach (var foundPuzzle in vowelMovements)
                {
                    if (foundPuzzle.Solution == "I LIKE the LOOK of the sun reflecting off the frozen LAKE.")
                    {
                        foundPuzzleThatShouldHaveBeenExcluded = true;
                        break;
                    }
                }
                Assert.IsTrue(foundPuzzleThatShouldHaveBeenExcluded);
            }
            public void M_N_ExcludesClueWithDate()
            {
                VowelMovement        puzzle                = new VowelMovement();
                List <VowelMovement> vowelMovements        = puzzle.FindPuzzle("m", "n");
                bool foundPuzzleThatShouldHaveBeenExcluded = false;

                foreach (var foundPuzzle in vowelMovements)
                {
                    if (foundPuzzle.Solution == "I saw a science fiction film about the first MAN to MINE the MOON.")
                    {
                        foundPuzzleThatShouldHaveBeenExcluded = true;
                        break;
                    }
                }
                Assert.IsFalse(foundPuzzleThatShouldHaveBeenExcluded);
            }
            public void D_N_ExcludesAlreadyPostedClue()
            {
                VowelMovement        puzzle                = new VowelMovement();
                List <VowelMovement> vowelMovements        = puzzle.FindPuzzle("d", "n");
                bool foundPuzzleThatShouldHaveBeenExcluded = false;

                foreach (var foundPuzzle in vowelMovements)
                {
                    if (foundPuzzle.Solution == "A DANE hid in the DEN by the sand DUNE in Anholt.")
                    {
                        foundPuzzleThatShouldHaveBeenExcluded = true;
                        break;
                    }
                }
                Assert.IsFalse(foundPuzzleThatShouldHaveBeenExcluded);
            }
            public void Null_L_FindsExpectedPuzzle()
            {
                VowelMovement        puzzle         = new VowelMovement();
                List <VowelMovement> vowelMovements = puzzle.FindPuzzle(null, "l");
                bool foundExpectedPuzzle            = false;

                foreach (var foundPuzzle in vowelMovements)
                {
                    if (foundPuzzle.Solution == "What was the name of the OWL who felt ILL after eating an EEL fried in OIL and drinking ALL the ALE? [AL]")
                    {
                        foundExpectedPuzzle = true;
                        break;
                    }
                }
                Assert.IsTrue(foundExpectedPuzzle, "Did not find expected puzzle.");
            }
            public void Q_T_FindsExpectedPuzzle()
            {
                VowelMovement        puzzle         = new VowelMovement();
                List <VowelMovement> vowelMovements = puzzle.FindPuzzle("q", "t");
                bool foundExpectedPuzzle            = false;

                foreach (var foundPuzzle in vowelMovements)
                {
                    if (foundPuzzle.Solution == "The reporter got QUITE a QUOTE from the mayor, who QUIT the next day.")
                    {
                        foundExpectedPuzzle = true;
                        break;
                    }
                }
                Assert.IsTrue(foundExpectedPuzzle, "Did not find expected puzzle.");
            }
            public void J_B_FindsExpectedPuzzle()
            {
                VowelMovement        puzzle         = new VowelMovement();
                List <VowelMovement> vowelMovements = puzzle.FindPuzzle("j", "b");
                bool foundExpectedPuzzle            = false;

                foreach (var foundPuzzle in vowelMovements)
                {
                    if (foundPuzzle.Solution == @"During a JOB interview, they said, ""I like the cut of your JIB"", and gave me a playful JAB.")
                    {
                        foundExpectedPuzzle = true;
                        break;
                    }
                }
                Assert.IsTrue(foundExpectedPuzzle, "Did not find expected puzzle.");
            }
            public void Br_Null_FindsExpectedPuzzle()
            {
                VowelMovement        puzzle         = new VowelMovement();
                List <VowelMovement> vowelMovements = puzzle.FindPuzzle("br", null);
                bool foundExpectedPuzzle            = false;

                foreach (var foundPuzzle in vowelMovements)
                {
                    if (foundPuzzle.Solution == "The day started poorly - She singed off a BROW trying to BREW coffee, and couldn't find her favorite BRA.")
                    {
                        foundExpectedPuzzle = true;
                        break;
                    }
                }
                Assert.IsTrue(foundExpectedPuzzle, "Did not find expected puzzle.");
            }
 public void Deserialize(string fileName)
 {
     using (TextReader reader = new StreamReader(fileName))
     {
         if (_xmlSerializer.Deserialize(reader) is WeekOfPuzzles deserializedPuzzles)
         {
             MondayWordSquare             = deserializedPuzzles.MondayWordSquare;
             TuesdayVowelMovement         = deserializedPuzzles.TuesdayVowelMovement;
             WednesdayALittleAlliteration = deserializedPuzzles.WednesdayALittleAlliteration;
             ThursdayVowelMovement        = deserializedPuzzles.ThursdayVowelMovement;
             FridayALittleAlliteration    = deserializedPuzzles.FridayALittleAlliteration;
             SelectedWords      = deserializedPuzzles.SelectedWords;
             Theme              = deserializedPuzzles.Theme;
             MondayOfWeekPosted = deserializedPuzzles.MondayOfWeekPosted;
         }
     }
 }
            public void NewObject_ReturnsExpectedString()
            {
                VowelMovement puzzle = new VowelMovement();

                Assert.AreEqual("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tscheduled", puzzle.GoogleSheetRow);
            }
            public void Example_ReturnsExpectedString()
            {
                VowelMovement vowelMovement = new VowelMovement();

                Assert.AreEqual("Each morning I have * * muffins with a cup of weak * because it's good for my *.", vowelMovement.ReplaceAllCapsWordsWithAsterisks("Each morning I have BROWN BRAN muffins with a cup of weak BRINE because it's good for my BRAIN."));
            }