public void Created_resolver_does_not_contain_fallback_resolver_when_there_is_no_parent([MinimalInfo(HasParent = false)] IProvidesResolutionInfo resInfo, ResolverFactory sut) { // Act var resolver = sut.CreateResolver(resInfo); // Assert var types = GetListOfResolverTypesUsed(resolver); Assert.That(types, Does.Not.Contain(typeof(FallbackResolverProxy))); }
public void Created_resolver_contains_regular_resolver([MinimalInfo] IProvidesResolutionInfo resInfo, ResolverFactory sut) { // Act var resolver = sut.CreateResolver(resInfo); // Assert var types = GetListOfResolverTypesUsed(resolver); Assert.That(types, Contains.Item(typeof(Resolver))); }
public void Created_resolver_contains_name_injecting_resolver([MinimalInfo] IProvidesResolutionInfo resInfo, ResolverFactory sut) { // Act var resolver = sut.CreateResolver(resInfo); // Assert var types = GetListOfResolverTypesUsed(resolver); Assert.That(types, Contains.Item(typeof(RegisteredNameInjectingResolverProxy))); }
public void Created_resolver_does_not_contain_caching_resolver_when_caching_is_disabled([MinimalInfo] IProvidesResolutionInfo resInfo, ResolverFactory sut) { // Arrange SetOptions(resInfo, new ContainerOptions(useInstanceCache: false)); // Act var resolver = sut.CreateResolver(resInfo); // Assert var types = GetListOfResolverTypesUsed(resolver); Assert.That(types, Does.Not.Contain(typeof(CachingResolverProxy))); }
public void Created_resolver_does_not_contain_dynamic_resolution_resolver_when_the_option_is_not_enabled([MinimalInfo(HasParent = false)] IProvidesResolutionInfo resInfo, ResolverFactory sut) { // Arrange SetOptions(resInfo, new ContainerOptions(selfRegisterAResolver: false)); // Act var resolver = sut.CreateResolver(resInfo); // Assert var types = GetListOfResolverTypesUsed(resolver); Assert.That(types, Does.Not.Contain(typeof(DynamicRecursionResolverProxy))); }
public void Created_resolver_contains_dynamic_resolution_resolver_when_the_option_is_enabled([MinimalInfo] IProvidesResolutionInfo resInfo, ResolverFactory sut) { // Arrange SetOptions(resInfo, new ContainerOptions(selfRegisterAResolver: true)); // Act var resolver = sut.CreateResolver(resInfo); // Assert var types = GetListOfResolverTypesUsed(resolver); Assert.That(types, Contains.Item(typeof(DynamicRecursionResolverProxy))); }
public void Created_resolver_does_not_contain_instance_dictionary_resolver_when_the_option_is_not_enabled([MinimalInfo(HasParent = false)] IProvidesResolutionInfo resInfo, ResolverFactory sut) { // Arrange SetOptions(resInfo, new ContainerOptions(supportResolvingNamedInstanceDictionaries: false)); // Act var resolver = sut.CreateResolver(resInfo); // Assert var types = GetListOfResolverTypesUsed(resolver); Assert.That(types, Does.Not.Contain(typeof(NamedInstanceDictionaryResolverProxy))); }
public void Created_resolver_does_not_contain_circlar_dependency_resolver_when_the_option_is_not_enabled([MinimalInfo(HasParent = false)] IProvidesResolutionInfo resInfo, ResolverFactory sut) { // Arrange SetOptions(resInfo, new ContainerOptions(throwOnCircularDependencies: false)); // Act var resolver = sut.CreateResolver(resInfo); // Assert var types = GetListOfResolverTypesUsed(resolver); Assert.That(types, Does.Not.Contain(typeof(CircularDependencyPreventingResolverProxy))); }
public void Created_resolver_contains_unregistered_service_resolver_when_the_option_is_enabled([MinimalInfo] IProvidesResolutionInfo resInfo, ResolverFactory sut) { // Arrange SetOptions(resInfo, new ContainerOptions(resolveUnregisteredTypes: true)); // Act var resolver = sut.CreateResolver(resInfo); // Assert var types = GetListOfResolverTypesUsed(resolver); Assert.That(types, Contains.Item(typeof(UnregisteredServiceResolverProxy))); }
public void Created_resolver_does_not_contain_unregistered_service_resolver_in_parent_resolver([MinimalInfo] IProvidesResolutionInfo resInfo, [MinimalInfo] IProvidesResolutionInfo parentResInfo, ResolverFactory sut) { // Arrange SetOptions(resInfo, new ContainerOptions(resolveUnregisteredTypes: true)); SetOptions(parentResInfo, new ContainerOptions(resolveUnregisteredTypes: true)); Mock.Get(resInfo).SetupGet(x => x.Parent).Returns(parentResInfo); // Act var resolver = sut.CreateResolver(resInfo); // Assert var fallbackResolver = GetListOfResolversUsed(resolver).OfType <FallbackResolverProxy>().FirstOrDefault(); Assert.That(fallbackResolver, Is.Not.Null); var parentResolver = fallbackResolver.FallbackResolver; var parentResolverTypes = GetListOfResolverTypesUsed(parentResolver); Assert.That(parentResolverTypes, Does.Not.Contain(typeof(UnregisteredServiceResolverProxy))); }