예제 #1
0
        public HostViewContext()
        {
            RootPath       = GlobalCommon.HostCommon.RootPath;
            RunTimeLibPath = GlobalCommon.HostCommon.RootPath + HostJsConstants.COMPILED_ROOT_PATH;
            CommonLibPath  = GlobalCommon.HostCommon.RootPath;
            var viewdoc = new ViewDocument(_currentjse);

            _hostobject.Add(viewdoc.Name, viewdoc);
            var console = new ConsoleObject();

            _hostobject.Add(console.Name, console);
            var document = new JsDocument(_currentjse, RootPath);

            _hostobject.Add(document.Name, document);

            var loadtag = new LoadParser();
            var reftag  = new RefParser();
            var copytag = new CopyParser();
            var outtag  = new OutTag();
            var hjstag  = new HjsTag();

            //按照先后处理标签的顺序进行标签处理
            _hosttag.Add(loadtag.TagName, loadtag);
            _hosttag.Add(reftag.TagName, reftag);
            _hosttag.Add(copytag.TagName, copytag);
            //out会变为hjs标签
            _hosttag.Add(outtag.TagName, outtag);
            _hosttag.Add(hjstag.TagName, hjstag);
        }
예제 #2
0
        public HostLogicContext()
        {
            _currentjse = HostJs.NewInstance();
            var loadtag   = new LoadParser();
            var reftag    = new RefParser();
            var copytag   = new CopyParser();
            var actiontag = new ActionTag();

            //按照先后处理标签的顺序进行标签处理
            _hosttag.Add(loadtag.TagName, loadtag);
            _hosttag.Add(reftag.TagName, reftag);
            _hosttag.Add(copytag.TagName, copytag);
            _hosttag.Add(actiontag.TagName, actiontag);
            RootPath       = GlobalCommon.HostCommon.RootPath;
            CommonLibPath  = GlobalCommon.HostCommon.RootPath;
            RunTimeLibPath = GlobalCommon.HostCommon.RootPath + HostJsConstants.COMPILED_ROOT_PATH;
        }
예제 #3
0
        public void ParseCopiedRow()
        {
            var mockCopiedText = new Mock <ICopiedText>();

            mockCopiedText.Setup(x => x.Data).Returns("some description\t2000\tApple\tHandset Pchse");

            var controller = new TestController();
            var cs         = new CollectionSource(ObjectSpace, typeof(MockFactObject));
            var viewModel  = (IModelListView)Application.FindModelView(Application.FindListViewId(typeof(MockFactObject)));

            viewModel.EditorType = typeof(TestListEditor);
            var listView = Application.CreateListView(viewModel, cs, true);

            controller.SetView(listView);

            var copyParser  = new CopyParser(mockCopiedText.Object);
            var parsedArray = copyParser.ToArray();

            Assert.AreEqual("some description", parsedArray[0][0]);
            Assert.AreEqual("2000", parsedArray[0][1]);
            Assert.AreEqual("Apple", parsedArray[0][2]);
            Assert.AreEqual("Handset Pchse", parsedArray[0][3]);
        }