public void Start() { DateTime startDate; string outputString = ""; int weekCount = 0; try { Message.ShowTitle(); IO.DirectoryCheck(Settings.Default.OutputPath); startDate = DateEdit.GetWeekStartDate(DateTime.Now); weekCount = DateEdit.GetWeekCount(startDate); Message.ShowTargetWeek(startDate, weekCount); outputString = Template.CreateOutputString(startDate, weekCount); if (IO.CreateTextFile(Settings.Default.OutputPath, Settings.Default.OutputFileName, outputString, false)) { Message.ShowFinishedMessage(true); } else { Message.ShowFinishedMessage(false); } } catch (Exception ex) { Log.ExceptionOutput(ex, Settings.Default.LogPath, Settings.Default.LogFileName); throw; } }
public void GetWeekStartDateTest() { DateTime testDate = DateTime.Parse("2018/07/19"); DateTime output = DateEdit.GetWeekStartDate(testDate); Assert.AreEqual("2018/07/15", output.ToShortDateString()); }