示例#1
0
        public MockPluginEnvironment(IResourceStore storage)
        {
            _picoContainer     = new DefaultPicoContainer();
            _mockPicoContainer = new DefaultPicoContainer(_picoContainer);

            Storage = storage;
            if (storage != null)
            {
                _picoContainer.RegisterComponentInstance(storage);
            }
            File.Delete(".\\MockPluginEnvironment.ini");
            _settingStore = new Ini.IniFile(".\\MockPluginEnvironment.ini");

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

            actionManagerMock.SetupResult("GetKeyboardShortcut", "", typeof(IAction));
            _actionManager = (IActionManager)actionManagerMock.MockInstance;

            _uiManager       = (IUIManager) new DynamicMock(typeof(IUIManager)).MockInstance;
            _pluginLoader    = (IPluginLoader) new DynamicMock(typeof(IPluginLoader)).MockInstance;
            _resourceBrowser = (IResourceBrowser) new DynamicMock(typeof(IResourceBrowser)).MockInstance;
            _tabManager      = new MockTabManager();
            _resourceAP      = new MockAsyncProcessor();
            _networkAP       = new MockAsyncProcessor();
            _uiAP            = new MockAsyncProcessor();

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

            resourceIconManagerMock.SetupResult("IconColorDepth", ColorDepth.Depth8Bit);
            resourceIconManagerMock.SetupResult("GetIconIndex", 0, typeof(IResource));
            _resourceIconManager = (IResourceIconManager)resourceIconManagerMock.MockInstance;

            _notificationManager  = (INotificationManager) new DynamicMock(typeof(INotificationManager)).MockInstance;
            _textIndexManager     = (ITextIndexManager) new DynamicMock(typeof(ITextIndexManager)).MockInstance;
            _messageFormatter     = (IMessageFormatter) new DynamicMock(typeof(IMessageFormatter)).MockInstance;
            _displayColumnManager = (IDisplayColumnManager) new DynamicMock(typeof(IDisplayColumnManager)).MockInstance;

//            DynamicMock filterManagerMock = new DynamicMock( typeof(IFilterRegistry) );
            DynamicMock filterEngineMock = new DynamicMock(typeof(IFilterEngine));

            filterEngineMock.SetupResult("ExecRules", true, typeof(string), typeof(IResource));

            DynamicMock filterManagerMock = new DynamicMock(typeof(IFilterRegistry));

            _filterRegistry = (IFilterRegistry)filterManagerMock.MockInstance;

            _rcManager             = (IRemoteControlManager) new DynamicMock(typeof(IRemoteControlManager)).MockInstance;
            _trayIconManager       = (ITrayIconManager) new DynamicMock(typeof(ITrayIconManager)).MockInstance;
            _formattingRuleManager = (IFormattingRuleManager) new DynamicMock(typeof(IFormattingRuleManager)).MockInstance;
            _expirationRuleManager = (IExpirationRuleManager) new DynamicMock(typeof(IExpirationRuleManager)).MockInstance;
            _filteringFormsManager = (IFilteringFormsManager) new DynamicMock(typeof(IFilteringFormsManager)).MockInstance;
            _searchQueryExtensions = (ISearchQueryExtensions) new DynamicMock(typeof(ISearchQueryExtensions)).MockInstance;
            _filterEngine          = (IFilterEngine) new DynamicMock(typeof(IFilterEngine)).MockInstance;

            theInstance = this;
        }
示例#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"));
        }
示例#3
0
 public void RegisterComponentInstance(object componentInstance)
 {
     _picoContainer.RegisterComponentInstance(componentInstance);
 }
示例#4
0
文件: PicoCore.cs 项目: mo5h/omeo
 protected void RegisterComponentInstance(object impl)
 {
     _picoContainer.RegisterComponentInstance(impl);
 }