public void CanFindHierarchyTest() { ConfigurationDesignHost host = new ConfigurationDesignHost(); UIHierarchyService hierarchyService = host.GetService(typeof(IUIHierarchyService)) as UIHierarchyService; Assert.IsNotNull(hierarchyService); ApplicationConfigurationNode appNode = new ApplicationConfigurationNode(ApplicationData.FromCurrentAppDomain()); UIHierarchy hierarchy = new UIHierarchy(appNode, host, new ConfigurationContext(appNode.ConfigurationFile)); ConfigurationSectionCollectionNode node = new ConfigurationSectionCollectionNode(); appNode.Nodes.Add(node); node.Nodes.Add(new ConfigurationSectionNode()); hierarchyService.AddHierarchy(hierarchy); IUIHierarchy foundHierarchy = hierarchyService.GetHierarchy(appNode.Id); Assert.AreSame(hierarchy, foundHierarchy); }
public virtual void SetUp() { host = new ConfigurationDesignHost(); hierarchyService = (IUIHierarchyService)host.GetService(typeof(IUIHierarchyService)); configurationErrorLogService = (IConfigurationErrorLogService)host.GetService(typeof(IConfigurationErrorLogService)); xmlIncludeTypeService = (IXmlIncludeTypeService)host.GetService(typeof(IXmlIncludeTypeService)); nodeCreationService = (INodeCreationService)host.GetService(typeof(INodeCreationService)); container = (IContainer)host.GetService(typeof(IContainer)); linkNodeService = (ILinkNodeService)host.GetService(typeof(ILinkNodeService)); host.AddService(typeof(IUIService), new MyUIService(this)); validationErrorsCount = 0; configurationErrorsCount = 0; applicationNode = new ApplicationConfigurationNode(ApplicationData.FromCurrentAppDomain()); uiHierarchy = CreateHierarchyAndAddToHierarchyService(applicationNode, CreateDefaultConfiguration()); }
public void AddHierarchyAndEventFiredTest() { ConfigurationDesignHost host = new ConfigurationDesignHost(); UIHierarchyService hierarchyService = host.GetService(typeof(IUIHierarchyService)) as UIHierarchyService; hierarchyService.HierarchyAdded += new HierarchyAddedEventHandler(OnHierarchyAdded); Assert.IsNotNull(hierarchyService); ApplicationConfigurationNode appNode = new ApplicationConfigurationNode(ApplicationData.FromCurrentAppDomain()); IUIHierarchy hierarchy = new UIHierarchy(appNode, host, new ConfigurationContext(appNode.ConfigurationFile)); hierarchyService.AddHierarchy(hierarchy); Assert.IsTrue(addEventCalled); Assert.AreEqual(1, addEventCount); Assert.AreSame(hierarchy, eventHierarchy); ConfigurationSectionCollectionNode node = new ConfigurationSectionCollectionNode(); appNode.Nodes.Add(node); node.Nodes.Add(new ConfigurationSectionNode()); Assert.AreEqual(1, hierarchyService.hierarchies.Count); }
public void FixtureSetUp() { host = new ConfigurationDesignHost(); service = host.GetService(typeof(IDictionaryService)) as IDictionaryService; }