Ejemplo n.º 1
0
        public override void FixtureInit()
        {
            XmlElementPath path = new XmlElementPath();
            path.AddElement(new QualifiedName("note", "http://www.w3schools.com"));

            noteChildElements = SchemaCompletion.GetChildElementCompletion(path);
        }
		public override void FixtureInit()
		{			
			noteElementPath = new XmlElementPath();
			noteElementPath.Elements.Add(new QualifiedName("note", "http://www.w3schools.com"));

			elementData = SchemaCompletionData.GetChildElementCompletionData(noteElementPath); 
		}
		public void EmptyDocumentTest()
		{
			elementPath = XmlParser.GetActiveElementStartPathAtIndex("", 0);
			expectedElementPath = new XmlElementPath();
			Assert.IsTrue(elementPath.Equals(expectedElementPath), 
			              "Incorrect active element path.");
		}
		public void XmlElementPathHasOneElement()
		{
			XmlElementPath expectedPath = new XmlElementPath();
			expectedPath.AddElement(new QualifiedName("a", "a-namespace"));
			
			Assert.AreEqual(expectedPath, paths[0]);
		}
		public override void FixtureInit()
		{
			XmlElementPath path = new XmlElementPath();
			path.Elements.Add(new QualifiedName("schema", "http://www.w3.org/2001/XMLSchema"));
			
			schemaChildElements = SchemaCompletionData.GetChildElementCompletionData(path);
			schemaAttributes = SchemaCompletionData.GetAttributeCompletionData(path);
			
			// Get include elements attributes.
			path.Elements.Add(new QualifiedName("include", "http://www.w3.org/2001/XMLSchema"));
			includeAttributes = SchemaCompletionData.GetAttributeCompletionData(path);
		
			// Get annotation element info.
			path.Elements.RemoveLast();
			path.Elements.Add(new QualifiedName("annotation", "http://www.w3.org/2001/XMLSchema"));
			
			annotationChildElements = SchemaCompletionData.GetChildElementCompletionData(path);
			annotationAttributes = SchemaCompletionData.GetAttributeCompletionData(path);
		
			// Get app info attributes.
			path.Elements.Add(new QualifiedName("appinfo", "http://www.w3.org/2001/XMLSchema"));
			appInfoAttributes = SchemaCompletionData.GetAttributeCompletionData(path);
			
			// Get foo attributes.
			path = new XmlElementPath();
			path.Elements.Add(new QualifiedName("foo", "http://www.w3.org/2001/XMLSchema"));
			fooAttributes = SchemaCompletionData.GetAttributeCompletionData(path);
		}
		public void Init()
		{
			XmlElementPath path = new XmlElementPath();
			path.AddElement(new QualifiedName("a", "a-namespace"));
			path.AddElement(new QualifiedName("b", "b-namespace"));
			paths = new XmlElementPathsByNamespace(path);
		}
        public override void FixtureInit()
        {
            XmlElementPath path = new XmlElementPath();
            path.AddElement(new QualifiedName("foo", "http://foo.com"));

            fooChildElementCompletion = SchemaCompletion.GetChildElementCompletion(path);
        }
        public override void FixtureInit()
        {
            XmlElementPath path = new XmlElementPath();
            path.AddElement(new QualifiedName("html", "http://foo/xhtml"));

            htmlChildElements = SchemaCompletion.GetChildElementCompletion(path);
        }
        public void NotEqual()
        {
            XmlElementPath newPath = new XmlElementPath();
            newPath.Elements.Add(new QualifiedName("Foo", "bar"));

            Assert.IsFalse(newPath.Equals(path), "Should not be equal.");
        }
        public void OutOfStartTagPathTest1()
        {
            string text = "<foo xmlns='" + namespaceURI + "'> ";

            elementPath = XmlParser.GetActiveElementStartPath(text, text.Length);
            Assert.AreEqual(0, elementPath.Elements.Count, "Should have no path.");
        }
		public void ElementPathContainsSingleRootElement()
		{
			XmlElementPath path = new XmlElementPath();
			path.AddElement(new QualifiedName("root", String.Empty));
			
			Assert.AreEqual(path, selectedElement.Path);
		}
        public void Equality()
        {
            XmlElementPath newPath = new XmlElementPath();
            newPath.Elements.Add(new QualifiedName("foo", "http://foo"));

            Assert.IsTrue(newPath.Equals(path), "Should be equal.");
        }
		public override void FixtureInit()
		{
			XmlElementPath path = new XmlElementPath();
			path.Elements.Add(new QualifiedName("root", "http://foo"));
			path.Elements.Add(new QualifiedName("bar", "http://foo"));
			barElementAttributes = SchemaCompletionData.GetAttributeCompletionData(path);
		}
		public override void FixtureInit()
		{
			XmlElementPath path = new XmlElementPath();
			path.AddElement(new QualifiedName("foo", "http://foo.com"));
			
			attributeCompletionItems = SchemaCompletion.GetAttributeCompletion(path);
		}
        public void DesignSurfacePath2()
        {
            XmlElementPath expectedPath = new XmlElementPath();
            expectedPath.Elements.Add(new QualifiedName("DesignSurface", "clr-namespace:ICSharpCode.WpfDesign.Designer;assembly=ICSharpCode.WpfDesign.Designer", "designer"));

            Assert.AreEqual(expectedPath, designSurfacePath2);
        }
		public override void FixtureInit()
		{
			XmlElementPath path = new XmlElementPath();
			path.Elements.Add(new QualifiedName("body", "http://www.w3schools.com")); 
			
			bodyChildElements = SchemaCompletionData.GetChildElementCompletionData(path);
			bodyAttributes = SchemaCompletionData.GetAttributeCompletionData(path);
		}	
Ejemplo n.º 17
0
		public void TitleHasNoChildElements()
		{
			XmlElementPath path = new XmlElementPath();
			path.Elements.Add(new QualifiedName("note", "http://www.w3schools.com"));
			path.Elements.Add(new QualifiedName("title", "http://www.w3schools.com"));
			Assert.AreEqual(0, SchemaCompletionData.GetChildElementCompletionData(path).Length, 
			                "Should be no child elements.");
		}
		public void NotEqual()
		{
			XmlElementPath newPath = new XmlElementPath();
			newPath.AddElement(new QualifiedName("aaa", "a", "a"));
			newPath.AddElement(new QualifiedName("bbb", "b", "b"));
			
			Assert.IsFalse(newPath.Equals(path), "Should not be equal.");
		}
		public XamlExpressionContext(XmlElementPath elementPath, string attributeName, bool inAttributeValue)
		{
			if (elementPath == null)
				throw new ArgumentNullException("elementPath");
			this.ElementPath = elementPath;
			this.AttributeName = attributeName;
			this.InAttributeValue = inAttributeValue;
		}
		public void NoAttributesForUnknownElement()
		{
			XmlElementPath path = new XmlElementPath();
			path.AddElement(new QualifiedName("foobar", "http://www.w3schools.com"));
			XmlCompletionItemCollection attributes = SchemaCompletion.GetAttributeCompletion(path);
			
			Assert.AreEqual(0, attributes.Count, "Should not find attributes for unknown element.");
		}
		public override void FixtureInit()
		{
			XmlElementPath path = new XmlElementPath();
			path.AddElement(new QualifiedName("note", "http://www.w3schools.com"));
			
			attributeCompletionItems = SchemaCompletion.GetAttributeCompletion(path);
			attributeName = attributeCompletionItems[0].Text;
		}
		public void NoAttributesForUnknownElement()
		{
			XmlElementPath path = new XmlElementPath();
			path.Elements.Add(new QualifiedName("foobar", "http://www.w3schools.com"));
			ICompletionData[] attributes = SchemaCompletionData.GetAttributeCompletionData(path);
			
			Assert.AreEqual(0, attributes.Length, "Should not find attributes for unknown element.");
		}
		public void CompactPathItem()
		{
			XmlElementPath newPath = new XmlElementPath();
			newPath.AddElement(new QualifiedName("bar", "http://bar", "b"));
			
			path.Compact();
			Assert.IsTrue(newPath.Equals(path), "Should be equal.");
		}
Ejemplo n.º 24
0
 public void TextHasNoChildElements()
 {
     XmlElementPath path = new XmlElementPath();
     path.AddElement(new QualifiedName("note", "http://www.w3schools.com"));
     path.AddElement(new QualifiedName("text", "http://www.w3schools.com"));
     Assert.AreEqual(0, SchemaCompletion.GetChildElementCompletion(path).Count,
                     "Should be no child elements.");
 }
		public override void FixtureInit()
		{
			XmlElementPath path = new XmlElementPath();
			path.Elements.Add(new QualifiedName("project", "http://nant.sf.net//nant-0.84.xsd"));
			path.Elements.Add(new QualifiedName("attrib", "http://nant.sf.net//nant-0.84.xsd"));
			
			attributes = SchemaCompletionData.GetAttributeCompletionData(path);
		}
		public void GetAttributeValueCompletion_UnionMemberTypesJoinsTwoSimpleTypesButOneDoesNotExist_DoesNotThrowException()
		{
			var path = new XmlElementPath();
			path.AddElement(new QualifiedName("Component", namespaceURI));
			
			XmlCompletionItemCollection items = SchemaCompletion.GetAttributeValueCompletion(path, "KeyPath");
			
			Assert.AreEqual(0, items.Count);
		}
		public override void FixtureInit()
		{
			XmlElementPath path = new XmlElementPath();
			path.AddElement(new QualifiedName("link", schemaNamespace));
			path.NamespacesInScope.Add(new XmlNamespace("xlink", "http://www.w3.org/1999/xlink"));
			
			linkElementAttributes = SchemaCompletion.GetAttributeCompletion(path);
			linkElementAttributes.Sort();
		}
		public void Init()
		{
			path = new XmlElementPath();
			firstQualifiedName = new QualifiedName("foo", "http://foo", "f");
			path.AddElement(firstQualifiedName);
			
			secondQualifiedName = new QualifiedName("bar", "http://bar", "b");
			path.AddElement(secondQualifiedName);
		}
		public override void FixtureInit()
		{
			XmlElementPath path = new XmlElementPath();
			path.Elements.Add(new QualifiedName("note", "http://www.w3schools.com"));
			
			XmlSchemaElement element = SchemaCompletionData.FindElement(path);
			attribute = SchemaCompletionData.FindAttribute(element, "name");
			missingAttribute = SchemaCompletionData.FindAttribute(element, "missing");
		}
Ejemplo n.º 30
0
		public void GetChildElementCompletion_ParentElementIsSubstitutionGroupButNoCorrespondingElementInSchema_NullReferenceExceptionIsNotThrown()
		{
			var path = new XmlElementPath();
			path.AddElement(new QualifiedName("stylesheet", namespaceURI));
			
			XmlCompletionItemCollection items = SchemaCompletion.GetChildElementCompletion(path);
			
			Assert.AreEqual(0, items.Count);
		}
Ejemplo n.º 31
0
 void FindSelectedElement(string xml, int index)
 {
     path = XmlParser.GetActiveElementStartPathAtIndex(xml, index);
 }
        public XmlCompletionItemCollection GetElementCompletion(string textUpToCursor, XmlSchemaCompletion defaultSchema)
        {
            XmlElementPath parentPath = XmlParser.GetParentElementPath(textUpToCursor);

            return(GetElementCompletionForAllNamespaces(parentPath, defaultSchema));
        }
        public XmlCompletionItemCollection GetElementCompletionForAllNamespaces(XmlElementPath path, XmlSchemaCompletion defaultSchema)
        {
            XmlElementPathsByNamespace pathsByNamespace = new XmlElementPathsByNamespace(path);

            return(GetElementCompletion(pathsByNamespace, defaultSchema));
        }