public override void Apply(IInterceptedFakeObjectCall fakeObjectCall) { Guard.AgainstNull(fakeObjectCall, nameof(fakeObjectCall)); var newRule = CallRuleMetadata.CalledOnce( new PropertyBehaviorRule(fakeObjectCall.Method) { Value = fakeObjectCall.GetDefaultReturnValue(), Indices = fakeObjectCall.Arguments.ToArray(), }); Fake.GetFakeManager(fakeObjectCall.FakedObject).MutateUserRules( allUserRules => allUserRules.AddFirst(newRule)); newRule.Rule.Apply(fakeObjectCall); }
public void Apply(IInterceptedFakeObjectCall fakeObjectCall) { Guard.AgainstNull(fakeObjectCall, nameof(fakeObjectCall)); var newRule = new CallRuleMetadata { Rule = new PropertyBehaviorRule(fakeObjectCall.Method, this.fakeManager) { Value = fakeObjectCall.GetDefaultReturnValue(), Indices = fakeObjectCall.Arguments.ToArray(), }, CalledNumberOfTimes = 1 }; this.fakeManager.AllUserRules.AddFirst(newRule); newRule.Rule.Apply(fakeObjectCall); }
public void Apply(IInterceptedFakeObjectCall fakeObjectCall) { Guard.AgainstNull(fakeObjectCall, nameof(fakeObjectCall)); var newRule = new CallRuleMetadata { Rule = new PropertyBehaviorRule(fakeObjectCall.Method, this.fakeManager) { Value = fakeObjectCall.GetDefaultReturnValue(), Indices = fakeObjectCall.Arguments.ToArray(), }, CalledNumberOfTimes = 1 }; this.fakeManager.AllUserRules.AddFirst(newRule); newRule.Rule.Apply(fakeObjectCall); }
public void Apply(IInterceptedFakeObjectCall fakeObjectCall) { Guard.AgainstNull(fakeObjectCall, nameof(fakeObjectCall)); fakeObjectCall.SetReturnValue(fakeObjectCall.GetDefaultReturnValue()); }
public override void Apply(IInterceptedFakeObjectCall fakeObjectCall) { Guard.AgainstNull(fakeObjectCall, nameof(fakeObjectCall)); fakeObjectCall.SetReturnValue(fakeObjectCall.GetDefaultReturnValue()); }