public void EmptyObject_WithDate_CreatesExpectedFile() { const string EMPTY_OBJECT_WITH_DATE = @"<?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>"; string fileName = $"EmptyObject_example_{Process.GetCurrentProcess().Id}.xml"; if (File.Exists(fileName)) { File.Delete(fileName); } File.WriteAllText(fileName, EMPTY_OBJECT_WITH_DATE); WeekOfPuzzles weekOfPuzzles = new WeekOfPuzzles(); weekOfPuzzles.Deserialize(fileName); Assert.AreEqual(new DateTime(2019, 2, 25), weekOfPuzzles.MondayOfWeekPosted); }
public void WithoutDate_SetsMondayToMinValue() { string fileName = $"testcase_{Process.GetCurrentProcess().Id}.xml"; if (!File.Exists(fileName)) { File.WriteAllText(fileName, EXPECTED_TEXT); } WeekOfPuzzles weekOfPuzzles = new WeekOfPuzzles(); weekOfPuzzles.Deserialize(fileName); Assert.AreEqual(DateTime.MinValue, weekOfPuzzles.MondayOfWeekPosted); }
public void ReturnsExpectedObject() { string fileName = $"testcase_{Process.GetCurrentProcess().Id}.xml"; if (!File.Exists(fileName)) { File.WriteAllText(fileName, EXPECTED_TEXT); } WeekOfPuzzles weekOfPuzzles = new WeekOfPuzzles(); weekOfPuzzles.Deserialize(fileName); Assert.IsNotNull(weekOfPuzzles.MondayWordSquare); Assert.IsNotNull(weekOfPuzzles.TuesdayVowelMovement); Assert.IsNotNull(weekOfPuzzles.WednesdayALittleAlliteration); Assert.AreEqual("WeeklyTheme", weekOfPuzzles.Theme); }