public void DoesNotGenerateObjectNameIfIdAttributeSpecified() { const string CONTEXTPATH = "/ContextPath/"; const string xml = @"<?xml version='1.0' encoding='UTF-8' ?> <objects xmlns='http://www.springframework.net'> <object id='mypage' type='MyPage.aspx' /> <object id='mycontrol' type='MyControl.ascx' /> </objects>"; WebObjectFactory objectFactory = new WebObjectFactory(CONTEXTPATH, false); TestWebObjectDefinitionReader reader = new TestWebObjectDefinitionReader(objectFactory.ContextPath, objectFactory, new XmlUrlResolver()); using (VirtualEnvironmentMock env = new VirtualEnvironmentMock(CONTEXTPATH + "test.aspx", null, null, CONTEXTPATH, true)) { env.VirtualPath2ArtifactsTable[CONTEXTPATH + "MyPage.aspx"] = typeof(Spring.Web.UI.Page); env.VirtualPath2ArtifactsTable[CONTEXTPATH + "MyControl.ascx"] = typeof(Spring.Web.UI.UserControl); reader.LoadObjectDefinitions(new StringResource(xml)); } Assert.IsTrue(objectFactory.ContainsObjectDefinition("mypage")); Assert.AreEqual(typeof(Spring.Web.UI.Page), objectFactory.GetType("mypage")); Assert.IsTrue(objectFactory.ContainsObjectDefinition("mycontrol")); }
public void ControlDefinitionsGetMarkedAbstract() { const string CONTEXTPATH = "/ContextPath/"; const string xml = @"<?xml version='1.0' encoding='UTF-8' ?> <objects xmlns='http://www.springframework.net'> <object type='MyControl.ascx' /> </objects>"; WebObjectFactory objectFactory = new WebObjectFactory(CONTEXTPATH, false); TestWebObjectDefinitionReader reader = new TestWebObjectDefinitionReader(objectFactory.ContextPath, objectFactory, new XmlUrlResolver()); using (VirtualEnvironmentMock env = new VirtualEnvironmentMock(CONTEXTPATH + "test.aspx", null, null, CONTEXTPATH, true)) { env.VirtualPath2ArtifactsTable[CONTEXTPATH + "MyControl.ascx"] = typeof(Spring.Web.UI.UserControl); reader.LoadObjectDefinitions(new StringResource(xml)); } Assert.IsTrue(objectFactory.ContainsObjectDefinition("Spring.Web.UI.UserControl")); Assert.IsTrue(objectFactory.GetObjectDefinition("Spring.Web.UI.UserControl").IsAbstract); }