Ejemplo n.º 1
0
        // *****************************************************************************

        /// ****************************************************************************
        /// <summary>
        /// 提交意见按钮事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// ****************************************************************************
        protected void btnSubmitOpinion_ServerClick(object sender, System.EventArgs e)
        {
            try
            {
                WorkCase workCase = Rms.WorkFlow.WorkCaseManager.GetWorkCase(this.ViewState["_CaseCode"].ToString());

                Procedure procedure = DefinitionManager.GetProcedureDifinition(workCase.ProcedureCode, true);

                Act  currentAct  = workCase.GetAct(this.ActCode);
                Task currentTask = procedure.GetTask(currentAct.ToTaskCode);
                Rms.WorkFlow.WorkCaseManager.SaveSignOpinionText(workCase, currentAct, currentTask, this.IUser.UserCode, this.HiddenOption.Value);
                BLL.WorkFlowRule.SaveWorkFlowCase(workCase);

                //WorkFlowSaveClick(this,EventArgs.Empty);

                Response.Write(Rms.Web.JavaScript.ScriptStart);
                Response.Write(Rms.Web.JavaScript.OpenerReload(false));
                Response.Write(Rms.Web.JavaScript.WinClose(false));
                Response.Write(Rms.Web.JavaScript.ScriptEnd);
            }
            catch (Exception ex)
            {
                ApplicationLog.WriteLog(this.ToString(), ex, "");
            }
        }
 public void SetUp()
 {
     var changer = new N2.Edit.Workflow.StateChanger();
     var activator = new ContentActivator(changer, MockRepository.GenerateStrictMock<IItemNotifier>(), new EmptyProxyFactory());
     DefinitionBuilder builder = new DefinitionBuilder(new DefinitionMap(), new Fakes.FakeTypeFinder(typeof(RestrictsChildWithCardinality), typeof(ChildWithCardinality)), new TransformerBase<IUniquelyNamed>[0], new EngineSection { Definitions = new DefinitionCollection { DefineUnattributedTypes = true } });
     definitions = new DefinitionManager(new[] { new DefinitionProvider(builder) }, new ITemplateProvider[0], activator, changer);
 }
Ejemplo n.º 3
0
 public GroupDef(DefinitionManager manager, JObject src)
     : base(manager, src)
 {
     childrenDefs = JsonHelpers.Defs <ElementDef>(
         manager, src, "children", true
         );
 }
Ejemplo n.º 4
0
        public override void SetUp()
        {
            base.SetUp();

            finder = new FakeTypeFinder(typeof(XmlableItem).Assembly, typeof(XmlableItem), typeof(XmlableItem2));
            notifier = mocks.Stub<IItemNotifier>();
            mocks.Replay(notifier);

            activator = new ContentActivator(new N2.Edit.Workflow.StateChanger(), notifier, new InterceptingProxyFactory());
            definitions = new DefinitionManager(
                new[] {new DefinitionProvider(new DefinitionBuilder(new DefinitionMap(), 
                    finder, 
                    new TransformerBase<IUniquelyNamed>[0],
                    TestSupport.SetupEngineSection()))}, 
                activator, new StateChanger(), new DefinitionMap());
            definitions.Start();
            parser = mocks.StrictMock<IUrlParser>();
            Expect.On(parser)
                .Call(parser.BuildUrl(null))
                .IgnoreArguments()
                .Do(new BuildUrl(delegate(ContentItem itemToBuild)
                                    {
                                        string url = "/" + itemToBuild.Name + ".aspx";
                                        foreach (ContentItem parent in Find.EnumerateParents(itemToBuild, null))
                                        {
                                            if (parent.Parent != null)
                                                url = "/" + parent.Name + url;
                                        }
                                        return url.ToUrl();
                                    }))
                .Repeat.Any();
            mocks.Replay(parser);

            persister = TestSupport.SetupFakePersister();
        }
Ejemplo n.º 5
0
 public ValueDef(DefinitionManager manager, JObject src)
     : base(manager, src)
 {
     formatDef   = JsonHelpers.FormatDef(manager, src);
     fixedSize   = src.Value <int?>("size");
     zeroSortKey = src.Value <bool>("zeroSortKey");
 }
Ejemplo n.º 6
0
 public MembersDef(DefinitionManager manager, JObject src)
     : base(manager, src)
 {
     memberDefs         = JsonHelpers.Defs <ElementDef>(manager, src, "members");
     signatures         = GetSignatures();
     _canContainFormIds = memberDefs.Any(d => d.canContainFormIds);
 }
Ejemplo n.º 7
0
        /// ****************************************************************************
        /// <summary>
        /// 数据加载
        /// </summary>
        /// ****************************************************************************
        private void LoadData()
        {
            try
            {
                WorkFlowActStrategyBuilder sb = new WorkFlowActStrategyBuilder();
                sb.AddStrategy(new Strategy(DAL.QueryStrategy.WorkFlowActStrategyName.ActCode, this.ActCode));

                string sql = sb.BuildMainQueryString();

                QueryAgent QA     = new QueryAgent();
                EntityData entity = QA.FillEntityData("WorkFlowAct", sql);
                this.ViewState["_CaseCode"] = entity.CurrentRow["CaseCode"].ToString();
                QA.Dispose();
                entity.Dispose();

                WorkCase workCase = Rms.WorkFlow.WorkCaseManager.GetWorkCase(this.ViewState["_CaseCode"].ToString());

                this.ViewState["_ApplicationCode"] = workCase.ApplicationCode;

                Act currentAct = workCase.GetAct(this.ActCode);

                Procedure procedure = DefinitionManager.GetProcedureDifinition(workCase.ProcedureCode, true);

                this.ViewState["_ProcedureCode"] = procedure.ProcedureCode;

                Task currentTask = procedure.GetTask(currentAct.ToTaskCode);

                this.contentspan.InnerHtml = WriteOpinion(workCase, currentTask, currentAct);
            }
            catch (Exception ex)
            {
                ApplicationLog.WriteLog(this.ToString(), ex, "");
            }
        }
Ejemplo n.º 8
0
        public ActorValueFormat(DefinitionManager manager, JObject src)
            : base(manager, src)
        {
            var enumSrc = manager.ResolveDefSource("ActorValueEnum");

            actorValueEnum = (EnumDef)manager.BuildDef(enumSrc);
        }
Ejemplo n.º 9
0
 public UnionDef(DefinitionManager manager, JObject src)
     : base(manager, src)
 {
     elementDefs        = JsonHelpers.Defs <ElementDef>(manager, src, "elements");
     decider            = JsonHelpers.Decider(manager, src);
     _canContainFormIds = elementDefs.Any(d => d.canContainFormIds);
 }
Ejemplo n.º 10
0
        public bool AddGrasshopperData(GrasshopperData grasshopperData)
        {
            var objId = grasshopperData.ObjectId;

            if (objId.IsNull || _grasshopperData.ContainsKey(objId))
            {
                return(false);
            }

            DefinitionManager.Load(grasshopperData.Definition, new string[] { DwgPath });
            var definition = DefinitionManager.Definition(grasshopperData.Definition);

            if (definition == null)
            {
                return(false);
            }

            foreach (var param in GrasshopperPlayer.GetInputParametersValues(definition))
            {
                if (param.Item2 is Type type)
                {
                    grasshopperData.AddProperty(param.Item1, type);
                }
                else
                {
                    grasshopperData.AddProperty(param.Item1, param.Item2);
                }
            }
            definition.Dispose();
            return(true);
        }
Ejemplo n.º 11
0
        private void UpdateDrawable(GrasshopperData grasshopperData)
        {
            if (!grasshopperData.IsVisible)
            {
                return;
            }

            var definition = DefinitionManager.Definition(grasshopperData.Definition);

            if (definition == null)
            {
                return;
            }

            GrasshopperPlayer.Run(definition, grasshopperData, Document);
            var newDrawable = new CompoundDrawable
            {
                Color         = GhDataSettings.Color,
                ColorSelected = GhDataSettings.Color,
                IsRenderMode  = GhDataSettings.VisualStyle == GH_PreviewMode.Shaded
            };

            GrasshopperPreview.GetPreview(definition, newDrawable);
            definition.Dispose();
            _grasshopperData[grasshopperData.ObjectId] = newDrawable;
        }
Ejemplo n.º 12
0
        public SimulationManager(ISettings settings, UpdateHub updateHub)
        {
            mainLock = new object();

            this.settings = settings; //TODO: Where are the settings?

            extensionLoader = new ExtensionLoader(settings);
            extensionLoader.LoadExtensions();

            definitionManager = new DefinitionManager(extensionLoader);

            var persistenceManager = new DiskPersistenceManager(extensionLoader, definitionManager, settings);

            ResourceManager = new ResourceManager(extensionLoader, definitionManager, settings, persistenceManager);
            ResourceManager.InsertUpdateHub(updateHub);

            chunkSubscription = updateHub.Subscribe(ResourceManager.GlobalChunkCache, DefaultChannels.Chunk);
            ResourceManager.GlobalChunkCache.InsertUpdateHub(updateHub);
            Service    = new GameService(ResourceManager);
            simulation = new Simulation(ResourceManager, extensionLoader, Service)
            {
                IsServerSide = true
            };
            backgroundThread = new Thread(SimulationLoop)
            {
                Name         = "Simulation Loop",
                IsBackground = true
            };
        }
Ejemplo n.º 13
0
        public override void LoadData()
        {
            base.LoadData();
            Master = DetermineIfMaster();
            if (!Master)
            {
                var set = new DefinitionSet();
                EnergyWeapons.Definitions.Create(set);
                MyAPIGateway.Utilities.SendModMessage(MOD_MESSAGE_DEFINITION_CHANNEL,
                                                      MyAPIGateway.Utilities.SerializeToXML(set));
                return;
            }

            MyAPIGateway.Utilities.RegisterMessageHandler(MOD_MESSAGE_PING_MASTER_CHANNEL, MasterPingHandler);
            MyAPIGateway.Utilities.RegisterMessageHandler(MOD_MESSAGE_DEFINITION_CHANNEL, MasterDefinitionHandler);

            _loggerStatic = new CustomLogger();

            Definitions = new DefinitionManager();
            {
                var set = new DefinitionSet();
                EnergyWeapons.Definitions.Create(set);
                Definitions.Add(set);
            }

            MyAPIGateway.Entities.OnEntityNameSet   += CheckEntityComponents;
            MyVisualScriptLogicProvider.ItemSpawned += ItemSpawned;
            Logger.Info($"Initialized");
        }
Ejemplo n.º 14
0
        public override void SetUp()
        {
            base.SetUp();
            DefinitionBuilder builder  = new DefinitionBuilder(new DefinitionMap(), typeFinder, new TransformerBase <IUniquelyNamed> [0], TestSupport.SetupEngineSection());
            IItemNotifier     notifier = mocks.DynamicMock <IItemNotifier>();

            mocks.Replay(notifier);
            var changer = new N2.Edit.Workflow.StateChanger();

            definitions = new DefinitionManager(new[] { new DefinitionProvider(builder) }, new ContentActivator(changer, notifier, new EmptyProxyFactory()), changer, new DefinitionMap());

            versioner = mocks.StrictMock <IVersionManager>();
            var urls = new FakeEditUrlManager();

            editManager = new EditManager(definitions, persister, versioner, null, null, null, urls, changer, new EditableHierarchyBuilder(new SecurityManager(new ThreadContext(), new EditSection()), TestSupport.SetupEngineSection()), new EditSection());
            editManager.EnableVersioning = true;

            var engine = new FakeEngine();

            engine.Container.AddComponentInstance("editManager", typeof(IEditManager), editManager);

            engine.Container.AddComponentInstance("editSection", typeof(EditSection), new EditSection());

            Context.Replace(engine);
        }
Ejemplo n.º 15
0
 public FormatUnion(
     DefinitionManager manager, JObject src
     ) : base(manager, src)
 {
     decider    = JsonHelpers.Decider(manager, src);
     formatDefs = JsonHelpers.Defs <FormatDef>(manager, src, "formats");
 }
		public override void SetUp()
		{
			base.SetUp();

			finder = new FakeTypeFinder(typeof(XmlableItem).Assembly, typeof(XmlableItem), typeof(XmlableItem2));
			notifier = mocks.Stub<IItemNotifier>();
			mocks.Replay(notifier);

			activator = new ContentActivator(new N2.Edit.Workflow.StateChanger(), notifier, new InterceptingProxyFactory());
			definitions = new DefinitionManager(
				new[] {new DefinitionProvider(new DefinitionBuilder(new DefinitionMap(), 
					finder, 
					new TransformerBase<IUniquelyNamed>[0],
					TestSupport.SetupEngineSection()))}, 
				activator, new StateChanger(), new DefinitionMap());
			definitions.Start();
			parser = mocks.StrictMock<IUrlParser>();
			Expect.On(parser)
				.Call(parser.BuildUrl(null))
				.IgnoreArguments()
				.Do(new BuildUrl(delegate(ContentItem itemToBuild)
									{
										string url = "/" + itemToBuild.Name + ".aspx";
										foreach (ContentItem parent in Find.EnumerateParents(itemToBuild, null))
										{
											if (parent.Parent != null)
												url = "/" + parent.Name + url;
										}
										return url.ToUrl();
									}))
				.Repeat.Any();
			mocks.Replay(parser);

			persister = TestSupport.SetupFakePersister();
		}
Ejemplo n.º 17
0
        private void button_Profiles_Click(object sender, EventArgs e)
        {
            DefinitionManager <Profile> dm = new DefinitionManager <Profile>(Model.Definitions.Profiles);

            dm.ShowDialog();
            //
            OnSdProfileDefinitionChanged();
        }
Ejemplo n.º 18
0
 public StringDef(DefinitionManager manager, JObject src)
     : base(manager, src)
 {
     prefix    = src.Value <int?>("prefix");
     padding   = src.Value <int?>("padding");
     localized = src.Value <bool>("localized");
     keepCase  = src.Value <bool>("keepCase");
 }
Ejemplo n.º 19
0
 public MainRecordDef(DefinitionManager manager, JObject src)
     : base(manager, src)
 {
     ErrorHelpers.CheckDefProperty(src, "signature");
     _signature     = src.Value <string>("signature");
     headerDef      = BuildHeaderDef(src.Value <JObject>("flags"));
     containedInDef = (FormIdDef)JsonHelpers.Def(manager, src, "containedInElement");
 }
Ejemplo n.º 20
0
        private void tsm_Profiles_Click(object sender, EventArgs e)
        {
            var dm = new DefinitionManager <Profile>(_model.Definitions.Profiles);

            dm.ShowDialog();
            //
            ModelForm.OnSdProfileDefinitionChanged();
        }
Ejemplo n.º 21
0
        private void tsm_Materials_Click(object sender, EventArgs e)
        {
            var dm = new DefinitionManager <Material>(_model.Definitions.Materials);

            dm.ShowDialog();
            //
            ModelForm.OnSdMaterialDefinitionChanged();
        }
Ejemplo n.º 22
0
 public StructDef(DefinitionManager manager, JObject src)
     : base(manager, src)
 {
     elementDefs        = JsonHelpers.Defs <ElementDef>(manager, src, "elements");
     sortKeyIndices     = JsonHelpers.List <int>(src, "sortKey");
     elementMap         = JsonHelpers.List <int>(src, "elementMap");
     _canContainFormIds = elementDefs.Any(d => d.canContainFormIds);
 }
Ejemplo n.º 23
0
        private void button_Materials_Click(object sender, EventArgs e)
        {
            DefinitionManager <Material> dm = new DefinitionManager <Material>(Model.Definitions.Materials);

            dm.ShowDialog();
            //
            OnSdMaterialDefinitionChanged();
        }
Ejemplo n.º 24
0
 public PluginManager(IEventRegister register, DefinitionManager definitionManager)
 {
     _eventRegister     = register;
     _definitionManager = definitionManager;
     _discoverer        = new PluginDiscoverer <TPlugin>();
     _assemblies        = new List <Assembly>();
     _plugins           = new List <TPlugin>();
 }
Ejemplo n.º 25
0
 public CTDAFunction(DefinitionManager manager, JObject src)
     : base(manager, src)
 {
     index      = src.Value <UInt16>("index");
     name       = src.Value <string>("name");
     paramType1 = ParseParamType(src, "paramType1");
     paramType2 = ParseParamType(src, "paramType2");
     paramType3 = ParseParamType(src, "paramType3");
 }
Ejemplo n.º 26
0
        public static ElementDef ElementDef(
            DefinitionManager manager, JObject src, string key
            )
        {
            ErrorHelpers.CheckDefProperty(src, key);
            var defSrc = src.Value <JObject>(key);

            return((ElementDef)manager.BuildDef(defSrc));
        }
Ejemplo n.º 27
0
 public ElementCounter(DefinitionManager manager, JObject src)
     : base(manager, src)
 {
     _path = src.Value <string>("path");
     if (path == null)
     {
         throw new Exception("Path property is null.");
     }
 }
Ejemplo n.º 28
0
        public static Def Def(DefinitionManager manager, JObject src, string key)
        {
            if (!src.ContainsKey(key))
            {
                return(null);
            }
            var defSrc = src.Value <JObject>(key);

            return(manager.BuildDef(defSrc));
        }
Ejemplo n.º 29
0
        public static FormatDef FormatDef(DefinitionManager manager, JObject src)
        {
            if (!src.ContainsKey("format"))
            {
                return(null);
            }
            var formatSrc = src.Value <JObject>("format");

            return((FormatDef)manager.BuildDef(formatSrc));
        }
Ejemplo n.º 30
0
        public static void Setup(out IDefinitionProvider[] definitionProviders, out IDefinitionManager definitions, out ContentActivator activator, out IItemNotifier notifier, out InterceptingProxyFactory proxyFactory, params Type[] itemTypes)
        {
            var map = new DefinitionMap();

            definitionProviders = SetupDefinitionProviders(map, itemTypes);
            notifier            = new ItemNotifier();
            proxyFactory        = new InterceptingProxyFactory();
            activator           = new ContentActivator(new N2.Edit.Workflow.StateChanger(), notifier, proxyFactory);
            definitions         = new DefinitionManager(definitionProviders, activator, new StateChanger(), new DefinitionMap());
            ((DefinitionManager)definitions).Start();
        }
Ejemplo n.º 31
0
 public void DeployBpmnTest()
 {
     using (DefinitionManager manager = new DefinitionManager(new ProcessDefinitionStore()))
     {
         DeploymentEntity result;
         var      path = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.Parent;
         FileInfo item;
         item   = path.GetFiles("subProcess.bpmn2").FirstOrDefault();
         result = manager.DeployBpmn(item.FullName, "deploy2", null);
     }
 }
Ejemplo n.º 32
0
        public DefinitionManagerTests()
        {
            using (BpmDbContext context = new BpmDbContext())
            {
                context.Database.CreateIfNotExists();
                context.Database.Initialize(true);
            }
            ProcessDefinitionStore store = new ProcessDefinitionStore();

            manager = new DefinitionManager(store);
        }
Ejemplo n.º 33
0
		public override void SetUp()
		{
			base.SetUp();

			user = CreatePrincipal("SomeSchmuck");

			map = new DefinitionMap();
			DefinitionBuilder builder = new DefinitionBuilder(map, typeFinder, new TransformerBase<IUniquelyNamed>[0], new EngineSection());
			IItemNotifier notifier = mocks.DynamicMock<IItemNotifier>();
			mocks.Replay(notifier);
			var changer = new N2.Edit.Workflow.StateChanger();
			activator = new ContentActivator(changer, notifier, new EmptyProxyFactory());
			definitions = new DefinitionManager(new[] { new DefinitionProvider(builder) }, new ITemplateProvider[0], activator, changer);
		}
Ejemplo n.º 34
0
        public override void SetUp()
        {
            base.SetUp();
            DefinitionBuilder builder = new DefinitionBuilder(new DefinitionMap(), typeFinder, new TransformerBase<IUniquelyNamed>[0], TestSupport.SetupEngineSection());
            IItemNotifier notifier = mocks.DynamicMock<IItemNotifier>();
            mocks.Replay(notifier);
            var changer = new N2.Edit.Workflow.StateChanger();
            definitions = new DefinitionManager(new[] { new DefinitionProvider(builder) }, new ContentActivator(changer, notifier, new EmptyProxyFactory()), changer, new DefinitionMap());

            versioner = mocks.StrictMock<IVersionManager>();
            var urls = new FakeEditUrlManager();
            editManager = new EditManager(definitions, persister, versioner, null, null, urls, changer, new EditableHierarchyBuilder(new SecurityManager(new ThreadContext(), new EditSection()), TestSupport.SetupEngineSection()), new EditSection());
            editManager.EnableVersioning = true;

            var engine = new FakeEngine();
            engine.Container.AddComponentInstance("editManager", typeof(IEditManager), editManager);

            engine.Container.AddComponentInstance("editSection", typeof(EditSection), new EditSection());

            Context.Replace(engine);
        }
Ejemplo n.º 35
0
        public override void SetUp()
        {
            base.SetUp();
            var urls = new FakeEditUrlManager();
            DefinitionBuilder builder = new DefinitionBuilder(typeFinder, new EngineSection(), urls);
            IItemNotifier notifier = mocks.DynamicMock<IItemNotifier>();
            mocks.Replay(notifier);
            var changer = new N2.Edit.Workflow.StateChanger();
            DefinitionManager definitions = new DefinitionManager(builder, changer, notifier, new EmptyProxyFactory());

            versioner = mocks.StrictMock<IVersionManager>();
            editManager = new EditManager(definitions, persister, versioner, null, null, null, urls, changer, new EditSection());
            editManager.EnableVersioning = true;

            var engine = new FakeEngine();
            engine.AddComponentInstance("editManager", typeof(IEditManager), editManager);

            engine.AddComponentInstance("editSection", typeof(EditSection), new EditSection());

            Context.Replace(engine);
        }
Ejemplo n.º 36
0
        public override void SetUp()
        {
            base.SetUp();

            root = CreateOneItem<RegularPage>(1, "root", null);
            about = CreateOneItem<AboutUsSectionPage>(2, "about", root);
            executives = CreateOneItem<ExecutiveTeamPage>(3, "executives", about);
            search = CreateOneItem<SearchPage>(4, "search", root);

            var typeFinder = new FakeTypeFinder2();
            typeFinder.typeMap[typeof(ContentItem)] = this.NearbyTypes()
                .BelowNamespace("N2.Extensions.Tests.Mvc.Models").AssignableTo<ContentItem>().Union(typeof(ContentItem)).ToArray();
            typeFinder.typeMap[typeof(IController)] = this.NearbyTypes()
                .BelowNamespace("N2.Extensions.Tests.Mvc.Controllers").AssignableTo<IController>().Except(typeof(AnotherRegularController))
                .ToArray();

            var changer = new StateChanger();
            var definitions = new DefinitionManager(new[] { new DefinitionProvider(new DefinitionBuilder(new DefinitionMap(), typeFinder, new TransformerBase<IUniquelyNamed>[0], TestSupport.SetupEngineSection())) }, new ITemplateProvider[0], new ContentActivator(changer, null, new EmptyProxyFactory()), changer);
            httpContext = new FakeHttpContext();
            var webContext = new FakeWebContextWrapper(httpContext);
            var host = new Host(webContext, root.ID, root.ID);
            var parser = TestSupport.Setup(persister, webContext, host);
            controllerMapper = new ControllerMapper(typeFinder, definitions);
            Url.DefaultExtension = "";
            N2.Web.Url.ApplicationPath = "/";

            engine = mocks.DynamicMock<IEngine>();
            SetupResult.For(engine.Resolve<ITypeFinder>()).Return(typeFinder);
            SetupResult.For(engine.Definitions).Return(definitions);
            SetupResult.For(engine.UrlParser).Return(parser);
            SetupResult.For(engine.Persister).Return(persister);
            SetupResult.For(engine.Resolve<RequestPathProvider>()).Return(new RequestPathProvider(webContext, parser, new ErrorNotifier(), new HostSection()));
            var editUrlManager = new FakeEditUrlManager();
            SetupResult.For(engine.ManagementPaths).Return(editUrlManager);
            engine.Replay();

            route = new ContentRoute(engine, new MvcRouteHandler(), controllerMapper, null);

            routes = new RouteCollection { route };
        }
Ejemplo n.º 37
0
        public override void SetUp()
        {
            base.SetUp();

            root = CreateOneItem<RegularPage>(1, "root", null);
            about = CreateOneItem<AboutUsSectionPage>(2, "about", root);
            executives = CreateOneItem<ExecutiveTeamPage>(3, "executives", about);
            search = CreateOneItem<SearchPage>(4, "search", root);

            var typeFinder = new FakeTypeFinder2();
            typeFinder.typeMap[typeof(ContentItem)] = this.NearbyTypes()
                .BelowNamespace("N2.Extensions.Tests.Mvc.Models").AssignableTo<ContentItem>().Union(typeof(ContentItem)).ToArray();
            typeFinder.typeMap[typeof(IController)] = this.NearbyTypes()
                .BelowNamespace("N2.Extensions.Tests.Mvc.Controllers").AssignableTo<IController>().Except(typeof(AnotherRegularController))
                .ToArray();

            var editUrlManager = new FakeEditUrlManager();
            var definitions = new DefinitionManager(new DefinitionBuilder(typeFinder, new EngineSection(), editUrlManager), new N2.Edit.Workflow.StateChanger(), null, new EmptyProxyFactory());
            var webContext = new ThreadContext();
            var host = new Host(webContext, root.ID, root.ID);
            var parser = new UrlParser(persister, webContext, host, new HostSection());
            controllerMapper = new ControllerMapper(typeFinder, definitions);
            Url.DefaultExtension = "";

            engine = mocks.DynamicMock<IEngine>();
            SetupResult.For(engine.Resolve<ITypeFinder>()).Return(typeFinder);
            SetupResult.For(engine.Definitions).Return(definitions);
            SetupResult.For(engine.UrlParser).Return(parser);
            SetupResult.For(engine.Persister).Return(persister);
            SetupResult.For(engine.ManagementPaths).Return(editUrlManager);
            engine.Replay();

            route = new ContentRoute(engine, new MvcRouteHandler(), controllerMapper, null);

            httpContext = new FakeHttpContext();
            routes = new RouteCollection { route };
        }
Ejemplo n.º 38
0
        public override void SetUp()
        {
            base.SetUp();

            user = CreatePrincipal("SomeSchmuck");

            DefinitionBuilder builder = new DefinitionBuilder(typeFinder, new EngineSection(), new FakeEditUrlManager());
            IItemNotifier notifier = mocks.DynamicMock<IItemNotifier>();
            mocks.Replay(notifier);
            definitions = new DefinitionManager(builder, new N2.Edit.Workflow.StateChanger(), notifier, new EmptyProxyFactory());
        }