public void TestConvertUsToUKFormat_GivenUKDateFormat_WithoutTime_ReturnsGivenDateInUKFormat() { // Arrange var usDateFormat = "29/11/2017"; var expected = "29/11/2017"; // Act var date = DateTimeFormatter.ConvertUsToUkFormat(usDateFormat); // Assert Assert.That(date, Is.EqualTo(expected)); }
public void TestConvertUsToUkFormat_GivenUKFormat_MissingTimeDefinition_ReturnTodaysDateInUKFormat() { // Arrange var usDateFormat = "10/29/2017"; var expected = DateTime.Today.ToString("dd/MM/yyyy"); // Act var date = DateTimeFormatter.ConvertUsToUkFormat(usDateFormat); // Assert Assert.That(date, Is.EqualTo(expected)); }
public void TestConverUsToUkFormat_GivenADefaultUsFormat_ReturnsExpectedUkDateFormatString() { // Arrange var expected = "21/12/2017"; DateTime testDate = new DateTime(2017, 12, 21); var testDateStr = testDate.ToString(); // Act var date = DateTimeFormatter.ConvertUsToUkFormat(testDateStr); // Assert Assert.That(date, Is.EqualTo(expected)); }