@@ -89,16 +89,42 @@ public void FindTypeSupportsSimpleNamesForSerilogTypes(string input, Type target
89
89
[ InlineData ( "Serilog.Settings.Configuration.Tests.Support.ClassWithStaticAccessors::AbstractProperty, Serilog.Settings.Configuration.Tests" , typeof ( AnAbstractClass ) ) ]
90
90
[ InlineData ( "Serilog.Settings.Configuration.Tests.Support.ClassWithStaticAccessors::InterfaceField, Serilog.Settings.Configuration.Tests" , typeof ( IAmAnInterface ) ) ]
91
91
[ InlineData ( "Serilog.Settings.Configuration.Tests.Support.ClassWithStaticAccessors::AbstractField, Serilog.Settings.Configuration.Tests" , typeof ( AnAbstractClass ) ) ]
92
- public void StaticMembersAccessorsCanBeUsedForReferenceTypes ( string input , Type targetType )
92
+ public void StaticMembersAccessorsCanBeUsedForAbstractTypes ( string input , Type targetType )
93
93
{
94
- var stringArgumentValue = new StringArgumentValue ( $ " { input } " ) ;
94
+ var stringArgumentValue = new StringArgumentValue ( input ) ;
95
95
96
96
var actual = stringArgumentValue . ConvertTo ( targetType , new ResolutionContext ( ) ) ;
97
97
98
98
Assert . IsAssignableFrom ( targetType , actual ) ;
99
99
Assert . Equal ( ConcreteImpl . Instance , actual ) ;
100
100
}
101
101
102
+ [ Theory ]
103
+ [ InlineData ( "Serilog.Settings.Configuration.Tests.Support.ClassWithStaticAccessors::ConcreteClassProperty, Serilog.Settings.Configuration.Tests" , typeof ( AConcreteClass ) ) ]
104
+ [ InlineData ( "Serilog.Settings.Configuration.Tests.Support.ClassWithStaticAccessors::ConcreteClassField, Serilog.Settings.Configuration.Tests" , typeof ( AConcreteClass ) ) ]
105
+ public void StaticMembersAccessorsCanBeUsedForConcreteReferenceTypes ( string input , Type targetType )
106
+ {
107
+ var stringArgumentValue = new StringArgumentValue ( input ) ;
108
+
109
+ var actual = stringArgumentValue . ConvertTo ( targetType , new ResolutionContext ( ) ) ;
110
+
111
+ Assert . IsAssignableFrom ( targetType , actual ) ;
112
+ Assert . Equal ( ConcreteImplOfConcreteClass . Instance , actual ) ;
113
+ }
114
+
115
+ [ Theory ]
116
+ [ InlineData ( "Serilog.Settings.Configuration.Tests.Support.ClassWithStaticAccessors::IntProperty, Serilog.Settings.Configuration.Tests" , typeof ( int ) , 42 ) ]
117
+ [ InlineData ( "Serilog.Settings.Configuration.Tests.Support.ClassWithStaticAccessors::StringProperty, Serilog.Settings.Configuration.Tests" , typeof ( string ) ,
118
+ "Serilog.Settings.Configuration.Tests.Support.ClassWithStaticAccessors::StringProperty, Serilog.Settings.Configuration.Tests" ) ]
119
+ public void StaticMembersAccessorsCanBeUsedForBuiltInTypes ( string input , Type targetType , object expected )
120
+ {
121
+ var stringArgumentValue = new StringArgumentValue ( input ) ;
122
+
123
+ var actual = stringArgumentValue . ConvertTo ( targetType , new ResolutionContext ( ) ) ;
124
+
125
+ Assert . Equal ( expected , actual ) ;
126
+ }
127
+
102
128
[ Theory ]
103
129
// unknown type
104
130
[ InlineData ( "Namespace.ThisIsNotAKnownType::InterfaceProperty, Serilog.Settings.Configuration.Tests" , typeof ( IAmAnInterface ) ) ]
0 commit comments