Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add unit test for DateOnly and TimeOnly types (NET6.0+) #341

Merged
merged 1 commit into from
Jul 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
}
}
}