File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11// This software is part of the Autofac IoC container
2- // Copyright (c) 2007 - 2008 Autofac Contributors
2+ // Copyright (c) 2007 - 2018 Autofac Contributors
33// http://autofac.org
44//
55// Permission is hereby granted, free of charge, to any person
@@ -103,26 +103,24 @@ public IEnumerable<IComponentRegistration> RegistrationsFor(
103103 /// <returns>A fake object.</returns>
104104 private object CreateFake ( TypedService typedService )
105105 {
106- var fake = Create . Fake ( typedService . ServiceType , this . ApplyOptions ) ;
107-
108- if ( this . _callsBaseMethods )
109- {
110- A . CallTo ( fake ) . CallsBaseMethod ( ) ;
111- }
112-
113- return fake ;
106+ return Create . Fake ( typedService . ServiceType , this . ApplyOptions ) ;
114107 }
115108
116109 private void ApplyOptions ( IFakeOptions options )
117110 {
118111 if ( this . _strict )
119112 {
120- options . Strict ( ) ;
113+ options = options . Strict ( ) ;
121114 }
122115
123116 if ( this . _configureFake != null )
124117 {
125- options . ConfigureFake ( x => this . _configureFake ( x ) ) ;
118+ options = options . ConfigureFake ( x => this . _configureFake ( x ) ) ;
119+ }
120+
121+ if ( this . _callsBaseMethods )
122+ {
123+ options . CallsBaseMethods ( ) ;
126124 }
127125 }
128126 }
Original file line number Diff line number Diff line change @@ -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 {
@@ -198,6 +208,8 @@ public IBar Spawn()
198208 {
199209 throw new NotImplementedException ( ) ;
200210 }
211+
212+ public abstract void GoAbstractly ( ) ;
201213 }
202214
203215 public class Baz : IBaz
You can’t perform that action at this time.
0 commit comments