public void TryCompositeFormatDate_GivenString_FormatSuccessfully() { const string compositeFormat = "{0}-{1}-{2}"; DateTimeOffset now = DateTimeOffset.Now; Assert.IsTrue( EnhancedPatternMatching.TryCompositeFormatDate(now.ToString(), compositeFormat, out string?result)); Assert.AreEqual <string>(now.ToString("yyyy-M-dd"), result !); }
public void TryCompositeFormatDate_GivenUnconvertableDateText_FormatFails() { Assert.IsFalse( EnhancedPatternMatching.TryCompositeFormatDate("Inigo Montoya", "", out string?result)); }
public void TryCompositeFormatDate_GivenObject_FormatFails() { Assert.IsFalse( EnhancedPatternMatching.TryCompositeFormatDate(new object(), "", out string?result)); }