public void DatePrinting_FirstDayLowerThanSecond_CorrectReturn() { DateTime dateTime1 = new DateTime(2020, 09, 10); DateTime dateTime2 = new DateTime(2020, 09, 11); DateTimeFormatInfo currentCultureDatetimeFormat = CultureInfo.CurrentCulture.DateTimeFormat; string expectedResult = dateTime1.ToString("dd", currentCultureDatetimeFormat) + "-" + dateTime2.ToString(currentCultureDatetimeFormat.ShortDatePattern); DateFormatting datePrinter = new DateFormatting(); string result = datePrinter.DateToString(dateTime1, dateTime2); Assert.AreEqual(expectedResult, result); }
public void DatePrinting_SameDate_CorrectReturn() { DateTime dateTime1 = new DateTime(2020, 12, 10); DateTime dateTime2 = new DateTime(2020, 12, 10); DateTimeFormatInfo currentCultureDatetimeFormat = CultureInfo.CurrentCulture.DateTimeFormat; string expectedResult = dateTime1.ToString(currentCultureDatetimeFormat.ShortDatePattern); DateFormatting datePrinter = new DateFormatting(); string result = datePrinter.DateToString(dateTime1, dateTime2); Assert.AreEqual(expectedResult, result); }