public void AsDateTimeNegativeTest() { string value = "02/79/11"; DateTime defaultValue = new DateTime(); DateTime actual = StringExtensions.AsDateTime(value, defaultValue); Assert.IsTrue(actual.Equals(defaultValue)); }
public void AsDateTimeTest() { string value = Convert.ToString(DateTime.Now, CultureInfo.InvariantCulture); DateTime expected = DateTime.Parse(value, CultureInfo.InvariantCulture); DateTime defaultValue = new DateTime(); DateTime actual = StringExtensions.AsDateTime(value, defaultValue); Assert.IsTrue(actual.Equals(expected)); }