示例#1
0
        public void TestConstructorEcellException()
        {
            EcellException exception = new EcellException();
            Assert.IsNotNull(exception, "Constructor of type, EcellException failed to create instance.");

            exception = new EcellException("Message");
            Assert.IsNotNull(exception, "Constructor of type, EcellException failed to create instance.");
            Assert.AreEqual("Message", exception.Message, "Message is unexpected value.");

            exception = new EcellException("Message", new Exception());
            Assert.IsNotNull(exception, "Constructor of type, EcellException failed to create instance.");
            Assert.AreEqual("Message", exception.Message, "Message is unexpected value.");
        }
示例#2
0
 public void SetUp()
 {
     _unitUnderTest = new EcellException();
 }
示例#3
0
 public void TearDown()
 {
     _unitUnderTest = null;
 }
示例#4
0
        /// <summary>
        /// add the plugin to plugin list.
        /// </summary>
        /// <param name="p">plugin</param>
        public void AddPlugin(IEcellPlugin p)
        {
            EcellException ex = new EcellException(string.Format(MessageResources.ErrAdd, p.GetPluginName(), "Plugin"));
            if (p is IDockOwner)
            {
                if (m_dockOwner != null)
                    throw ex;
                m_dockOwner = (IDockOwner)p;
            }

            if (p is IDiagramEditor)
            {
                if (m_diagramEditor != null)
                    throw ex;
                m_diagramEditor = (IDiagramEditor)p;
            }

            if (p is IRootMenuProvider)
            {
                if (m_rootMenuProvider != null)
                    throw ex;
                m_rootMenuProvider = (IRootMenuProvider)p;
            }

            if (p is IDataHandler)
            {
                m_dataHandlerList.Add((IDataHandler)p);
            }

            if (p is IAnalysis)
            {
                m_analysisList.Add((IAnalysis)p);
            }

            if (p is IRasterizable)
            {
                m_rasterizableList.Add((IRasterizable)p);
            }

            if (p is ILayoutAlgorithm)
            {
                m_layoutAlgorithmList.Add((ILayoutAlgorithm)p);
            }

            if (!m_pluginList.ContainsKey(p.GetPluginName()))
            {
                p.Environment = m_env;
                p.Initialize();
                m_pluginList.Add(p.GetPluginName(), p);
                Dictionary<string, Delegate> plist = p.GetPublicDelegate();
                if (plist == null) return;

                foreach (string key in plist.Keys)
                {
                    m_delegateDic.Add(key, plist[key]);
                }
            }
        }