@@ -89,16 +89,42 @@ public void FindTypeSupportsSimpleNamesForSerilogTypes(string input, Type target
8989 [ InlineData ( "Serilog.Settings.Configuration.Tests.Support.ClassWithStaticAccessors::AbstractProperty, Serilog.Settings.Configuration.Tests" , typeof ( AnAbstractClass ) ) ]
9090 [ InlineData ( "Serilog.Settings.Configuration.Tests.Support.ClassWithStaticAccessors::InterfaceField, Serilog.Settings.Configuration.Tests" , typeof ( IAmAnInterface ) ) ]
9191 [ 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 )
9393 {
94- var stringArgumentValue = new StringArgumentValue ( $ " { input } " ) ;
94+ var stringArgumentValue = new StringArgumentValue ( input ) ;
9595
9696 var actual = stringArgumentValue . ConvertTo ( targetType , new ResolutionContext ( ) ) ;
9797
9898 Assert . IsAssignableFrom ( targetType , actual ) ;
9999 Assert . Equal ( ConcreteImpl . Instance , actual ) ;
100100 }
101101
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+
102128 [ Theory ]
103129 // unknown type
104130 [ InlineData ( "Namespace.ThisIsNotAKnownType::InterfaceProperty, Serilog.Settings.Configuration.Tests" , typeof ( IAmAnInterface ) ) ]
0 commit comments