Skip to content

Commit 3a6f6d1

Browse files
committed
Update TypeNameConverter.cs
1 parent 57bae8d commit 3a6f6d1

1 file changed

Lines changed: 50 additions & 1 deletion

File tree

src/Verify/Serialization/Converters/TypeNameConverter.cs

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,56 @@ namespace VerifyTests
1111
{
1212
public static class TypeNameConverter
1313
{
14-
static ConcurrentDictionary<Type, string> cacheDictionary = new();
14+
static ConcurrentDictionary<Type, string> cacheDictionary = new(
15+
new List<KeyValuePair<Type, string>>
16+
{
17+
new(typeof(string), "String"),
18+
new(typeof(sbyte), "SByte"),
19+
new(typeof(sbyte?), "Nullable<SByte>"),
20+
new(typeof(byte), "Byte"),
21+
new(typeof(byte?), "Nullable<Byte>"),
22+
new(typeof(bool), "Boolean"),
23+
new(typeof(bool?), "Nullable<Boolean>"),
24+
new(typeof(short), "Int16"),
25+
new(typeof(short?), "Nullable<Int16>"),
26+
new(typeof(ushort), "UInt16"),
27+
new(typeof(ushort?), "Nullable<UInt16>"),
28+
new(typeof(int), "Int32"),
29+
new(typeof(int?), "Nullable<Int32>"),
30+
new(typeof(uint), "UInt32"),
31+
new(typeof(uint?), "Nullable<UInt32>"),
32+
new(typeof(long), "Int64"),
33+
new(typeof(long?), "Nullable<Int64>"),
34+
new(typeof(nint), "IntPtr"),
35+
new(typeof(nint?), "Nullable<IntPtr>"),
36+
new(typeof(nuint), "UIntPtr"),
37+
new(typeof(nuint?), "Nullable<UIntPtr>"),
38+
new(typeof(decimal), "Decimal"),
39+
new(typeof(decimal?), "Nullable<Decimal>"),
40+
new(typeof(float), "Single"),
41+
new(typeof(float?), "Nullable<Single>"),
42+
new(typeof(double), "Double"),
43+
new(typeof(double?), "Nullable<Double>"),
44+
new(typeof(Guid), "Guid"),
45+
new(typeof(Guid?), "Nullable<Guid>"),
46+
new(typeof(DateTime), "DateTime"),
47+
new(typeof(DateTime?), "Nullable<DateTime>"),
48+
new(typeof(DateTimeOffset), "DateTimeOffset"),
49+
new(typeof(DateTimeOffset?), "Nullable<DateTimeOffset>"),
50+
new(typeof(TimeSpan), "TimeSpan"),
51+
new(typeof(TimeSpan?), "Nullable<TimeSpan>"),
52+
#if NET5_0_OR_GREATER
53+
new(typeof(Half), "Half"),
54+
new(typeof(Half?), "Nullable<Half>"),
55+
#endif
56+
#if NET6_0_OR_GREATER
57+
new(typeof(DateOnly), "DateOnly"),
58+
new(typeof(DateOnly?), "Nullable<DateOnly>"),
59+
new(typeof(TimeOnly), "TimeOnly"),
60+
new(typeof(TimeOnly?), "Nullable<TimeOnly>"),
61+
#endif
62+
});
63+
1564
static ConcurrentDictionary<ICustomAttributeProvider, string> infoCache = new();
1665

1766
static CSharpCodeProvider codeDomProvider = new();

0 commit comments

Comments
 (0)