Exemplo n.º 1
0
        protected virtual IPicoContainer WrapComponentInstances(Type decoratingComponentAdapterClass,
                                                                IPicoContainer picoContainer,
                                                                object[] wrapperDependencies)
        {
            Assert.IsTrue(typeof(DecoratingComponentAdapter).IsAssignableFrom(decoratingComponentAdapterClass));
            IMutablePicoContainer mutablePicoContainer = new DefaultPicoContainer();
            int         size = (wrapperDependencies != null ? wrapperDependencies.Length : 0) + 1;
            ICollection allComponentAdapters = picoContainer.ComponentAdapters;

            foreach (object adapter in allComponentAdapters)
            {
                IParameter[] parameters = new IParameter[size];
                parameters[0] = new ConstantParameter(adapter);
                for (int i = 1; i < parameters.Length; i++)
                {
                    parameters[i] = new ConstantParameter(wrapperDependencies[i - 1]);
                }
                IMutablePicoContainer instantiatingPicoContainer =
                    new DefaultPicoContainer(new ConstructorInjectionComponentAdapterFactory());
                instantiatingPicoContainer.RegisterComponentImplementation("decorator", decoratingComponentAdapterClass,
                                                                           parameters);
                mutablePicoContainer.RegisterComponent(
                    (IComponentAdapter)instantiatingPicoContainer.GetComponentInstance("decorator"));
            }
            return(mutablePicoContainer);
        }
Exemplo n.º 2
0
        public TestCore(Type resourceStoreType)
        {
            theInstance = this;

            _basePicoContainer = _picoContainer;
            _mockPicoContainer = new DefaultPicoContainer(_basePicoContainer);
            _picoContainer     = _mockPicoContainer;

            _basePicoContainer.RegisterComponentImplementation(resourceStoreType);
            _basePicoContainer.RegisterComponentImplementation(typeof(MockResourceTabProvider));

            _resourceAP = new MockAsyncProcessor();
            _networkAP  = new MockAsyncProcessor();
            _uiAP       = new MockAsyncProcessor();

            _basePicoContainer.RegisterComponentInstance(new DynamicMock(typeof(IPluginLoader)).MockInstance);
            _basePicoContainer.RegisterComponentInstance(new DynamicMock(typeof(ITextIndexManager)).MockInstance);
            _basePicoContainer.RegisterComponentInstance(new DynamicMock(typeof(IUIManager)).MockInstance);
            _basePicoContainer.RegisterComponentInstance(new DynamicMock(typeof(IResourceBrowser)).MockInstance);
            _basePicoContainer.RegisterComponentInstance(new DynamicMock(typeof(ISidebarSwitcher)).MockInstance);

            DynamicMock resourceIconManagerMock = new DynamicMock(typeof(IResourceIconManager));

            resourceIconManagerMock.SetupResult("IconColorDepth", ColorDepth.Depth8Bit);
            resourceIconManagerMock.SetupResult("GetIconIndex", 0, typeof(IResource));
            _basePicoContainer.RegisterComponentInstance(resourceIconManagerMock.MockInstance);

            DynamicMock actionManagerMock = new DynamicMock(typeof(IActionManager));

            actionManagerMock.SetupResult("GetKeyboardShortcut", "", typeof(IAction));
            _basePicoContainer.RegisterComponentInstance(actionManagerMock.MockInstance);

            _basePicoContainer.RegisterComponentInstance(new MockTabManager());

            DynamicMock displayColumnManagerMock = new DynamicMock(typeof(IDisplayColumnManager));

            _basePicoContainer.RegisterComponentInstance(displayColumnManagerMock.MockInstance);

            File.Delete(".\\MockPluginEnvironment.ini");
            _basePicoContainer.RegisterComponentInstance(new Ini.IniFile(".\\MockPluginEnvironment.ini"));
        }
Exemplo n.º 3
0
 public void RegisterComponentImplementation(Type componentImplementation)
 {
     _picoContainer.RegisterComponentImplementation(componentImplementation);
 }
Exemplo n.º 4
0
 protected PicoCore()
 {
     _picoContainer = new DefaultPicoContainer();
     _picoContainer.RegisterComponentImplementation(typeof(CategoryManager));
     _picoContainer.RegisterComponentImplementation(typeof(ResourceTreeManager));
     _picoContainer.RegisterComponentImplementation(typeof(WorkspaceManager));
     _picoContainer.RegisterComponentImplementation(typeof(UnreadManager));
     _picoContainer.RegisterComponentImplementation(typeof(FilterRegistry));
     _picoContainer.RegisterComponentImplementation(typeof(FormattingRuleManager));
     _picoContainer.RegisterComponentImplementation(typeof(ExpirationRuleManager));
     _picoContainer.RegisterComponentImplementation(typeof(FilteringFormsManager));
     _picoContainer.RegisterComponentImplementation(typeof(FilterEngine));
     _picoContainer.RegisterComponentImplementation(typeof(ContactManager));
     _picoContainer.RegisterComponentImplementation(typeof(FileResourceManager));
     _picoContainer.RegisterComponentImplementation(typeof(NotificationManager));
     _picoContainer.RegisterComponentImplementation(typeof(MessageFormatter));
     _picoContainer.RegisterComponentImplementation(typeof(CoreProps));
     _picoContainer.RegisterComponentImplementation(typeof(CorePropIds));
     _picoContainer.RegisterComponentImplementation(typeof(FavIconManager));
     _picoContainer.RegisterComponentImplementation(typeof(SearchQueryExtensions));
 }
Exemplo n.º 5
0
 protected void RegisterComponentImplementation(Type aType)
 {
     _picoContainer.RegisterComponentImplementation(aType);
 }