public void ShouldCreateResolutionCapableOfGeneratingArrays() { //GIVEN var resolution = new SpecialCasesOfResolutions <RecursiveInterface[]>(new CollectionGenerator(new GenericMethodProxyCalls())).CreateResolutionOfArray(); //WHEN //THEN Assert.True(resolution.Applies()); XAssert.NotNull(resolution.Apply(Any.Instance <IInstanceGenerator>())); XAssert.Equal(3, resolution.Apply(Any.Instance <IInstanceGenerator>()).Length); }
public void ShouldCreateResolutionCapableOfGeneratingArrays() { //GIVEN var resolution = new SpecialCasesOfResolutions <RecursiveInterface[]>().CreateResolutionOfArray(); //WHEN //THEN Assert.True(resolution.Applies()); Assert.NotNull(resolution.Apply(Root.Any.Instance <InstanceGenerator>())); Assert.AreEqual(3, resolution.Apply(Root.Any.Instance <InstanceGenerator>()).Length); }
public void ShouldCreateResolutionCapableOfGeneratingArrays() { //GIVEN var resolution = new SpecialCasesOfResolutions().CreateResolutionOfArray(); //WHEN //THEN Assert.True(resolution.AppliesTo(typeof(RecursiveInterface[]))); Assert.NotNull(resolution.Apply(Any.Instance <InstanceGenerator>(), Any.Instance <GenerationRequest>(), typeof(RecursiveInterface[]))); Assert.AreEqual(3, ((RecursiveInterface[])resolution.Apply(Any.Instance <InstanceGenerator>(), Any.Instance <GenerationRequest>(), typeof(RecursiveInterface[]))).Length); }
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); }