public void VerifyTypeReturnedFromCreateBag()
        {
            RandomNetGenParamsFactory fac = new RandomNetGenParamsFactory();
            IParamBag bag = fac.CreateBag();

            Assert.IsType(typeof(RandomNetGenParamBag), bag);
        }
        public void VerifyTypeReturnedFromCreateMgr()
        {
            RandomNetGenParamsFactory fac = new RandomNetGenParamsFactory();
            IParamMgr mgr = fac.CreateMgr();

            Assert.IsType(typeof(RandomNetGenParamMgr), mgr);
        }
示例#3
0
文件: UITestForm.cs 项目: BgRva/Blob1
 private void LoadParamView(Type type)
 {
     Cursor.Current = Cursors.WaitCursor;
     try
     {
         IParamsView view = null;
         if (type == typeof(RandomNetGenParamsCtrl))
         {
             #region RandomNetGenParamsCtrl
             IRandomNetGenParamBag bag = null;
             if (_Bags.ContainsKey(type.FullName))
             {
                 // retrieve existing bag
                 bag = _Bags[type.FullName] as IRandomNetGenParamBag;
             }
             else
             {
                 var fac = new RandomNetGenParamsFactory();
                 bag = fac.CreateBag() as IRandomNetGenParamBag;
                 _Bags.Add(type.FullName, bag);
             }
             view = new RandomNetGenParamsCtrl(Guid.NewGuid(), bag);
             #endregion
         }
         else if (type == typeof(ImportNetworkParamsCtrl))
         {
             #region ImportNetworkParamsCtrl
             IImportNetworkParamBag bag = null;
             if (_Bags.ContainsKey(type.FullName))
             {
                 // retrieve existing bag
                 bag = _Bags[type.FullName] as IImportNetworkParamBag;
             }
             else
             {
                 var fac = new ImportNetworkParamsFactory();
                 bag = fac.CreateBag() as IImportNetworkParamBag;
                 _Bags.Add(type.FullName, bag);
             }
             view = new ImportNetworkParamsCtrl(Guid.NewGuid(), bag);
             #endregion
         }
         else if (type == typeof(ExportNetworkParamsCtrl))
         {
             #region ExportNetworkParamsCtrl
             IExportNetworkParamBag bag = null;
             if (_Bags.ContainsKey(type.FullName))
             {
                 // retrieve existing bag
                 bag = _Bags[type.FullName] as IExportNetworkParamBag;
             }
             else
             {
                 var fac = new ExportNetworkParamsFactory();
                 bag = fac.CreateBag() as IExportNetworkParamBag;
                 _Bags.Add(type.FullName, bag);
             }
             view = new ExportNetworkParamsCtrl(Guid.NewGuid(), bag);
             #endregion
         }
         //else if (type == typeof(NodalCentralitiesParamsCtrl))
         //{
         //    #region NodalCentralitiesParamsCtrl
         //    INodalCentralitiesParamBag bag = null;
         //    if (_Bags.ContainsKey(type.FullName))
         //    {
         //        // retrieve existing bag
         //        bag = _Bags[type.FullName] as INodalCentralitiesParamBag;
         //    }
         //    else
         //    {
         //        var fac = new NodalCentralitiesParamsFactory();
         //        bag = fac.CreateBag() as INodalCentralitiesParamBag;
         //        _Bags.Add(type.FullName, bag);
         //    }
         //    view = new NodalCentralitiesParamsCtrl(Guid.NewGuid(), bag);
         //    #endregion
         //}
         //else if (type == typeof(XtrctSubnetByNodeAttribParamsCtrl))
         //{
         //    #region ExportNetworkParamsCtrl
         //    IXtrctSubnetByNodeAttribParamBag bag = null;
         //    if (_Bags.ContainsKey(type.FullName))
         //    {
         //        // retrieve existing bag
         //        bag = _Bags[type.FullName] as IXtrctSubnetByNodeAttribParamBag;
         //    }
         //    else
         //    {
         //        var fac = new XtrctSubnetByNodeAttribParamsFactory();
         //        bag = fac.CreateBag() as IXtrctSubnetByNodeAttribParamBag;
         //        _Bags.Add(type.FullName, bag);
         //    }
         //    view = new XtrctSubnetByNodeAttribParamsCtrl(Guid.NewGuid(), bag);
         //    #endregion
         //}
         //else if (type == typeof(ExctractSubnetByNodeIndexParamsCtrl))
         //{
         //    #region ExportNetworkParamsCtrl
         //    IExctractSubnetByNodeIndexParamBag bag = null;
         //    if (_Bags.ContainsKey(type.FullName))
         //    {
         //        // retrieve existing bag
         //        bag = _Bags[type.FullName] as IExctractSubnetByNodeIndexParamBag;
         //    }
         //    else
         //    {
         //        var fac = new ExctractSubnetByNodeIndexParamsFactory();
         //        bag = fac.CreateBag() as IExctractSubnetByNodeIndexParamBag;
         //        _Bags.Add(type.FullName, bag);
         //    }
         //    view = new ExctractSubnetByNodeIndexParamsCtrl(Guid.NewGuid(), bag);
         //    #endregion
         //}
         if (view != null)
         {
             if (_ParamsView != null)
             {
                 _ParamsView.ParamsView = view;
                 _ParamsView.Text = string.Format("{0} Test", type.Name);
                 _ParamsView.BringToFront();
                 Log(string.Format("Selected:  {0}", type.Name));
             }
         }
     }
     finally
     {
         Cursor.Current = Cursors.Default;
     }
 }