Ejemplo n.º 1
0
            public void EmptyObject_WithDate_CreatesExpectedFile()
            {
                WeekOfPuzzles weekOfPuzzles = new WeekOfPuzzles {
                    MondayOfWeekPosted = new DateTime(2019, 2, 25)
                };
                string fileName = $"EmptyObject_example_{Process.GetCurrentProcess().Id}.xml";

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

                var actualText = File.ReadAllText(fileName);

                Assert.AreEqual(@"<?xml version=""1.0"" encoding=""utf-8""?>
<WeekOfPuzzles xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">
  <SelectedWords>
    <string />
    <string />
    <string />
    <string />
    <string />
  </SelectedWords>
  <MondayOfWeekPosted>2019-02-25</MondayOfWeekPosted>
</WeekOfPuzzles>",
                                actualText);
            }
Ejemplo n.º 2
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);
            }