Example #1
0
        public ConfiguredCall SetResultForLastCall(IReturn valueToReturn, MatchArgs matchArgs)
        {
            var spec = _getCallSpec.FromLastCall(matchArgs);

            CheckResultIsCompatibleWithCall(valueToReturn, spec);
            _configuredResults.SetResult(spec, valueToReturn);
            return(new ConfiguredCall(action => _callActions.Add(spec, action)));
        }
Example #2
0
        private object GetResultValueUsingProvider(ICall call, Type type, IAutoValueProvider provider)
        {
            var valueToReturn = provider.GetValue(type);

            if (_autoValueBehaviour == AutoValueBehaviour.UseValueForSubsequentCalls)
            {
                var spec = _callSpecificationFactory.CreateFrom(call, MatchArgs.AsSpecifiedInCall);
                _callResults.SetResult(spec, new ReturnValue(valueToReturn));
            }

            return(valueToReturn);
        }
Example #3
0
        public void SetResultForCall(ICall call, IReturn valueToReturn, MatchArgs matchArgs)
        {
            var callSpecification = _callSpecificationFactory.CreateFrom(call, matchArgs);

            _configuredResults.SetResult(callSpecification, valueToReturn);
        }