@@ -209,13 +209,6 @@ public DefaultValue DefaultValue
209209 /// </summary>
210210 public abstract DefaultValueProvider DefaultValueProvider { get ; set ; }
211211
212- /// <summary>
213- /// The <see cref="Moq.DefaultValueProvider"/> used to initialize automatically stubbed properties.
214- /// It is equal to the value of <see cref="DefaultValueProvider"/> at the time when
215- /// <see cref="SetupAllProperties"/> was last called.
216- /// </summary>
217- internal abstract DefaultValueProvider AutoSetupPropertiesDefaultValueProvider { get ; set ; }
218-
219212 internal abstract SetupCollection MutableSetups { get ; }
220213
221214 /// <summary>
@@ -539,26 +532,7 @@ internal static void SetupSet(Mock mock, LambdaExpression expression, PropertyIn
539532
540533 Mock . SetupRecursive < MethodCall > ( mock , expression , setupLast : ( targetMock , _ , __ ) =>
541534 {
542- // Setting a mock's property through reflection will only work (i.e. the property will only remember the value
543- // it's being set to) if it is being stubbed. In order to ensure it's stubbed, we temporarily enable
544- // auto-stubbing (if that isn't already switched on).
545-
546- var temporaryAutoSetupProperties = targetMock . AutoSetupPropertiesDefaultValueProvider == null ;
547- if ( temporaryAutoSetupProperties )
548- {
549- targetMock . AutoSetupPropertiesDefaultValueProvider = targetMock . DefaultValueProvider ;
550- }
551- try
552- {
553- propertyToSet . SetValue ( targetMock . Object , value , null ) ;
554- }
555- finally
556- {
557- if ( temporaryAutoSetupProperties )
558- {
559- targetMock . AutoSetupPropertiesDefaultValueProvider = null ;
560- }
561- }
535+ propertyToSet . SetValue ( targetMock . Object , value , null ) ;
562536 return null ;
563537 } , allowNonOverridableLastProperty : true ) ;
564538 }
@@ -637,21 +611,7 @@ private static TSetup SetupRecursive<TSetup>(Mock mock, LambdaExpression origina
637611
638612 internal static void SetupAllProperties ( Mock mock )
639613 {
640- SetupAllProperties ( mock , mock . DefaultValueProvider ) ;
641- }
642-
643- internal static void SetupAllProperties ( Mock mock , DefaultValueProvider defaultValueProvider )
644- {
645- mock . MutableSetups . RemoveAllPropertyAccessorSetups ( ) ;
646- // Removing all the previous properties setups to keep the behaviour of overriding
647- // existing setups in `SetupAllProperties`.
648-
649- mock . AutoSetupPropertiesDefaultValueProvider = defaultValueProvider ;
650- // `SetupAllProperties` no longer performs properties setup like in previous versions.
651- // Instead it just enables a switch to setup properties on-demand at the moment of first access.
652- // In order for `SetupAllProperties`'s new mode of operation to be indistinguishable
653- // from how it worked previously, it's important to capture the default value provider at this precise
654- // moment, since it might be changed later (before queries to properties).
614+ // TODO: implement!
655615 }
656616
657617 #endregion
0 commit comments