Skip to content

Commit

Permalink
Add unit test for DateOnly and TimeOnly types (NET6.0+) (#341)
Browse files Browse the repository at this point in the history
  • Loading branch information
axunonb authored Jul 17, 2023
1 parent 2f9c180 commit c8a99c0
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/SmartFormat.Tests/Extensions/ReflectionSourceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,19 @@ private static object[] GetArgs()
};
}

#if NET
[Test]
public void DateOnly_TimeOnly()
{
var date = new DateOnly(2023, 12, 31);
var time = new TimeOnly(23, 45, 56);

var result = Smart.Format("{0:dd.MM.yyyy} - {1:HH\\:mm\\:ss}", date, time);

Assert.That(result, Is.EqualTo("31.12.2023 - 23:45:56"));
}
#endif

[Test]
public void Test_Properties()
{
Expand Down Expand Up @@ -280,4 +293,4 @@ internal class TestReflectionSource : ReflectionSource
{
public static string TypeCacheFieldName => nameof(TypeCache);
}
}
}

0 comments on commit c8a99c0

Please sign in to comment.