public FakeChain <T> UnconstrainedInstance(CachedReturnValueGeneration eachMethodReturnsTheSameValueOnEveryCall, ProxyGenerator generationIsDoneUsingProxies, IValueGenerator valueGenerator) { return(OrderedChainOfGenerationsWithTheFollowingLogic(TryTo( ResolveTheMostSpecificCases(valueGenerator), ElseTryTo(ResolveAsArray(), ElseTryTo(ResolveAsSimpleEnumerableAndList(), ElseTryTo(ResolveAsSimpleSet(), ElseTryTo(ResolveAsSimpleDictionary(), ElseTryTo(ResolveAsSortedList(), ElseTryTo(ResolveAsDelegate(), ElseTryTo(ResolveAsSortedSet(), ElseTryTo(ResolveAsSortedDictionary(), ElseTryTo(ResolveAsConcurrentDictionary(), ElseTryTo(ResolveAsConcurrentBag(), ElseTryTo(ResolveAsConcurrentQueue(), ElseTryTo(ResolveAsConcurrentStack(), ElseTryTo(ResolveAsKeyValuePair(), ElseTryTo(ResolveAsGenericEnumerator(), ElseTryTo(ResolveAsObjectEnumerator(), ElseTryTo(ResolveAsCollectionWithHeuristics(), ElseTryTo(ResolveAsInterfaceImplementationWhere(eachMethodReturnsTheSameValueOnEveryCall, generationIsDoneUsingProxies), ElseTryTo(ResolveAsAbstractClassImplementationWhere(eachMethodReturnsTheSameValueOnEveryCall, generationIsDoneUsingProxies), ElseTryTo(ResolveAsConcreteTypeWithNonConcreteTypesInConstructorSignature(), ElseTryTo(ResolveAsConcreteClass(valueGenerator), ElseReportUnsupportedType() ))))))))))))))))))))))); }
public FakeAbstractClass( CachedReturnValueGeneration generation, ProxyGenerator proxyGenerator) { _generation = generation; _proxyGenerator = proxyGenerator; _fallbackTypeGenerator = new FallbackTypeGenerator <T>(); //bug extract? }
public AbstractClassInterceptor( CachedReturnValueGeneration cachedGeneration, Func <Type, GenerationTrace, object> instanceSource, GenerationTrace trace) { _cachedGeneration = cachedGeneration; _instanceSource = instanceSource; _trace = trace; }
public FakeAbstractClass( CachedReturnValueGeneration generation, ProxyGenerator proxyGenerator, FallbackTypeGenerator <T> fallbackTypeGenerator) { _generation = generation; _proxyGenerator = proxyGenerator; _fallbackTypeGenerator = fallbackTypeGenerator; }
public AbstractClassInterceptor( CachedReturnValueGeneration cachedGeneration, Func <Type, GenerationRequest, object> instanceSource, GenerationRequest request) { _cachedGeneration = cachedGeneration; _instanceSource = instanceSource; _request = request; }
private readonly ConcurrentDictionary <Type, object> _unconstrainedFactoryCache = new ConcurrentDictionary <Type, object>(); //new MemoryCache("constrained"); public FakeChainFactory( CachedReturnValueGeneration cachedReturnValueGeneration, NestingLimit nestingLimit, ProxyGenerator proxyGenerator, ValueGenerator valueGenerator) { _cachedReturnValueGeneration = cachedReturnValueGeneration; _nestingLimit = nestingLimit; _proxyGenerator = proxyGenerator; _valueGenerator = valueGenerator; }
public IFakeChain <T> NewInstance( CachedReturnValueGeneration eachMethodReturnsTheSameValueOnEveryCall, NestingLimit nestingLimit, ProxyGenerator generationIsDoneUsingProxies, IValueGenerator valueGenerator) { return(LimitedTo(nestingLimit, UnconstrainedInstance( eachMethodReturnsTheSameValueOnEveryCall, generationIsDoneUsingProxies, valueGenerator))); }
public static BasicGenerator Create() { var valueGenerator = CreateValueGenerator(); var proxyGenerator = new ProxyGenerator(); var cachedReturnValueGeneration = new CachedReturnValueGeneration(new PerMethodCache <object>()); var specialCasesOfResolutions = new SpecialCasesOfResolutions(); var fallbackTypeGenerator = new FallbackTypeGenerator( new IFallbackGeneratedObjectCustomization[] { new FillPropertiesCustomization(), new FillFieldsCustomization() }); var resolutionsFactory = new ResolutionsFactory( specialCasesOfResolutions, fallbackTypeGenerator); var unconstrainedChain = new TemporaryChainForCollection(new[] { ResolutionsFactory.ResolveTheMostSpecificCases(valueGenerator), resolutionsFactory.ResolveAsArray(), resolutionsFactory.ResolveAsImmutableArray(), resolutionsFactory.ResolveAsSimpleEnumerableAndList(), resolutionsFactory.ResolveAsImmutableList(), resolutionsFactory.ResolveAsSimpleSet(), resolutionsFactory.ResolveAsImmutableHashSet(), resolutionsFactory.ResolveAsImmutableSortedSet(), resolutionsFactory.ResolveAsSimpleDictionary(), resolutionsFactory.ResolveAsImmutableDictionary(), resolutionsFactory.ResolveAsImmutableSortedDictionary(), resolutionsFactory.ResolveAsSortedList(), resolutionsFactory.ResolveAsImmutableQueue(), resolutionsFactory.ResolveAsImmutableStack(), ResolutionsFactory.ResolveAsDelegate(), resolutionsFactory.ResolveAsSortedSet(), resolutionsFactory.ResolveAsSortedDictionary(), resolutionsFactory.ResolveAsConcurrentDictionary(), resolutionsFactory.ResolveAsConcurrentBag(), resolutionsFactory.ResolveAsConcurrentQueue(), resolutionsFactory.ResolveAsConcurrentStack(), resolutionsFactory.ResolveAsKeyValuePair(), ResolutionsFactory.ResolveAsOptionalOption(), resolutionsFactory.ResolveAsGenericEnumerator(), ResolutionsFactory.ResolveAsObjectEnumerator(), ResolutionsFactory.ResolveAsCollectionWithHeuristics(), ResolutionsFactory.ResolveAsInterfaceImplementationWhere( cachedReturnValueGeneration, proxyGenerator), resolutionsFactory.ResolveAsAbstractClassImplementationWhere( cachedReturnValueGeneration, proxyGenerator), resolutionsFactory.ResolveAsConcreteTypeWithNonConcreteTypesInConstructorSignature(), ResolutionsFactory.ResolveAsVoidTask(), ResolutionsFactory.ResolveAsTypedTask(), resolutionsFactory.ResolveAsConcreteClass() }); var limitedGenerationChain = new LimitedGenerationChain(unconstrainedChain); var fakeOrdinaryInterfaceGenerator = new FakeOrdinaryInterface(cachedReturnValueGeneration, proxyGenerator); var allGenerator = new AllGenerator( valueGenerator, limitedGenerationChain, unconstrainedChain, fakeOrdinaryInterfaceGenerator); return(allGenerator); }
private static FakeOrdinaryInterface <T> ResolveAsInterfaceImplementationWhere(CachedReturnValueGeneration cachedGeneration, ProxyGenerator proxyGenerator) { return(new FakeOrdinaryInterface <T>(cachedGeneration, proxyGenerator)); }
private FakeAbstractClass <T> ResolveAsAbstractClassImplementationWhere(CachedReturnValueGeneration cachedGeneration, ProxyGenerator proxyGenerator) { return(new FakeAbstractClass <T>(cachedGeneration, proxyGenerator, _fallbackTypeGenerator)); }
public FakeOrdinaryInterface(CachedReturnValueGeneration cachedGeneration, ProxyGenerator proxyGenerator) { _cachedGeneration = cachedGeneration; _proxyGenerator = proxyGenerator; }
public InterfaceInterceptor(CachedReturnValueGeneration cachedGeneration, Func <Type, object> instanceSource) { _cachedGeneration = cachedGeneration; _instanceSource = instanceSource; }