@@ -89,6 +89,16 @@ public void CanResolveFakesWhichCallsBaseMethods()
8989 }
9090 }
9191
92+ [ Fact ]
93+ public void CanResolveFakesWhichCallsBaseMethodsAndInvokeAbstractMethod ( )
94+ {
95+ using ( var fake = new AutoFake ( callsBaseMethods : true ) )
96+ {
97+ var bar = fake . Resolve < Bar > ( ) ;
98+ bar . GoAbstractly ( ) ;
99+ }
100+ }
101+
92102 [ Fact ]
93103 public void CanResolveFakesWhichInvokeActionsWhenResolved ( )
94104 {
@@ -137,6 +147,49 @@ public void ProvidesInstances()
137147 }
138148 }
139149
150+ [ Fact ]
151+ public void CallsBaseMethodsOverridesStrict ( )
152+ {
153+ // A characterization test, intended to detect accidental changes in behavior.
154+ // This is an odd situation, since specifying both strict and callsBaseMethods only makes
155+ // sense when there are concrete methods on the fake that we want to be executed, but we
156+ // want to reject the invocation of any methods that are left abstract on the faked type.
157+ using ( var fake = new AutoFake ( callsBaseMethods : true , strict : true ) )
158+ {
159+ var bar = fake . Resolve < Bar > ( ) ;
160+ bar . Go ( ) ;
161+ Assert . True ( bar . Gone ) ;
162+ }
163+ }
164+
165+ [ Fact ]
166+ public void CallsBaseMethodsOverridesConfigureFake ( )
167+ {
168+ // A characterization test, intended to detect accidental changes in behavior.
169+ // Since callsBaseMethods applies globally and configureFake can affect individual
170+ // members, having configureFake override callsBaseMethods may be preferred.
171+ using ( var fake = new AutoFake (
172+ callsBaseMethods : true ,
173+ configureFake : f => A . CallTo ( ( ) => ( ( Bar ) f ) . Go ( ) ) . DoesNothing ( ) ) )
174+ {
175+ var bar = fake . Resolve < Bar > ( ) ;
176+ bar . Go ( ) ;
177+ Assert . True ( bar . Gone ) ;
178+ }
179+ }
180+
181+ [ Fact ]
182+ public void ConfigureFakeOverridesStrict ( )
183+ {
184+ using ( var fake = new AutoFake (
185+ strict : true ,
186+ configureFake : f => A . CallTo ( ( ) => ( ( Bar ) f ) . Go ( ) ) . DoesNothing ( ) ) )
187+ {
188+ var bar = fake . Resolve < Bar > ( ) ;
189+ bar . Go ( ) ;
190+ }
191+ }
192+
140193 public abstract class Bar : IBar
141194 {
142195 private bool _gone ;
@@ -155,6 +208,8 @@ public IBar Spawn()
155208 {
156209 throw new NotImplementedException ( ) ;
157210 }
211+
212+ public abstract void GoAbstractly ( ) ;
158213 }
159214
160215 public class Baz : IBaz
0 commit comments