Exemple #1
0
 public XamlMember GetDottedProperty (XamlType tagType, string tagNamespace, XamlPropertyName propName, bool tagIsRoot)
 {
     if (tagType == null) {
         throw new XamlInternalException(SR.Get("ParentlessPropertyElement", new object[] { propName.ScopedName }));
     }
     XamlMember xamlAttachableProperty = null;
     XamlType xamlType = null;
     string propNs = this.ResolveXamlNameNS(propName);
     if (propNs == null) {
         throw new XamlParseException(SR.Get("PrefixNotFound", new object[] { propName.Prefix }));
     }
     XamlType rootTagType = tagIsRoot ? tagType : null;
     bool flag = false;
     if (tagType.IsGeneric) {
         flag = this.PropertyTypeMatchesGenericTagType(tagType, tagNamespace, propNs, propName.OwnerName);
         if (flag) {
             xamlAttachableProperty = this.GetInstanceOrAttachableProperty(tagType, propName.Name, rootTagType);
             if (xamlAttachableProperty != null) {
                 return xamlAttachableProperty;
             }
         }
     }
     XamlTypeName typeName = new XamlTypeName(propNs, propName.Owner.Name);
     xamlType = this.GetXamlType(typeName, true);
     bool flag2 = tagType.CanAssignTo(xamlType);
     if (flag2) {
         xamlAttachableProperty = this.GetInstanceOrAttachableProperty(xamlType, propName.Name, rootTagType);
     }
     else {
         xamlAttachableProperty = this.GetXamlAttachableProperty(xamlType, propName.Name);
     }
     if (xamlAttachableProperty != null) {
         return xamlAttachableProperty;
     }
     XamlType declaringType = flag ? tagType : xamlType;
     if (flag || flag2) {
         return this.CreateUnknownMember(declaringType, propName.Name);
     }
     return this.CreateUnknownAttachableMember(declaringType, propName.Name);
 }
		public void ToStringTypeArgumentsNullEntry ()
		{
			#if PCL
			Assert.Throws<ArgumentNullException> (() => {
			#else
			Assert.Throws<NullReferenceException> (() => {
			#endif
				var n = new XamlTypeName ("urn:foo", "FooBar", new XamlTypeName [] { null, new XamlTypeName ("urn:bar", "FooBarBaz") });
				Assert.AreEqual ("{urn:foo}FooBar()", n.ToString (), "#1");
			});
		}
		public void ConstructorNameNull ()
		{
			// allowed.
			var xtn = new XamlTypeName ("urn:foo", null);
			Assert.IsNotNull (xtn.TypeArguments, "#1");
		}
		public void ToStringNamespaceLookupInsufficient ()
		{
			var n = new XamlTypeName ("urn:foo", "Foo", new XamlTypeName [] {new XamlTypeName ("urn:bar", "Bar"), new XamlTypeName ("urn:baz", "Baz")});
			var lookup = new MyNamespaceLookup ();
			lookup.Add ("a", "urn:foo");
			lookup.Add ("c", "urn:baz");
			// it fails because there is missing mapping for urn:bar.
			Assert.AreEqual ("a:Foo({urn:bar}Bar, c:Baz)", n.ToString (lookup), "#1");
		}
		public void ToStringTypeArgumentsNullEntry ()
		{
			var n = new XamlTypeName ("urn:foo", "FooBar", new XamlTypeName [] {null, new XamlTypeName ("urn:bar", "FooBarBaz")});
			Assert.AreEqual ("{urn:foo}FooBar()", n.ToString (), "#1");
		}
		public void ToStringDefault ()
		{
			var n = new XamlTypeName ();
			n.ToString ();
		}
		public void GetTypeFromXamlTypeNameWithClrName ()
		{
			// ensure that this does *not* resolve clr type name.
			var xn = new XamlTypeName ("clr-namespace:System;assembly=mscorlib", "DateTime");
			var ctx = NewStandardContext ();
			var xt = ctx.GetXamlType (xn);
			Assert.IsNull (xt, "#1");

			ctx = new XamlSchemaContext ();
			xt = ctx.GetXamlType (xn);
			Assert.IsNotNull (xt, "#2");
		}
Exemple #8
0
        internal XamlType GetXamlType (XamlTypeName typeName, bool returnUnknownTypesOnFailure, bool skipVisibilityCheck)
        {
            XamlType xamlType = this._schemaContext.GetXamlType(typeName);
//            if (((xamlType != null) && !skipVisibilityCheck) && !xamlType.IsVisibleTo(this.LocalAssembly)) {
//                xamlType = null;
//            }
            if ((xamlType != null) || !returnUnknownTypesOnFailure) {
                return xamlType;
            }
            XamlType[] typeArguments = null;
            if (typeName.HasTypeArgs) {
                typeArguments = ArrayHelper.ConvertArrayType(typeName.TypeArguments, this.GetXamlTypeOrUnknown);
            }
            return new XamlType(typeName.Namespace, typeName.Name, typeArguments, this.SchemaContext);
        }
Exemple #9
0
 internal XamlType GetXamlType(XamlTypeName typeName)
 {
     return(GetXamlType(typeName, false, false));
 }
Exemple #10
0
        internal XamlType GetXamlType(XamlName typeName, bool returnUnknownTypesOnFailure)
        {
            XamlTypeName fullTypeName = GetXamlTypeName(typeName);

            return(GetXamlType(fullTypeName, returnUnknownTypesOnFailure));
        }
Exemple #11
0
        // -------------------- internal ------------------------

        private XamlType GetXamlTypeOrUnknown(XamlTypeName typeName)
        {
            return(GetXamlType(typeName, true));
        }
Exemple #12
0
        public static ParsedMarkupExtensionInfo Parse(string raw, IXamlNamespaceResolver nsResolver, XamlSchemaContext sctx)
        {
            if (raw == null)
            {
                throw new ArgumentNullException("raw");
            }
            if (raw.Length == 0 || raw [0] != '{')
            {
                throw Error("Invalid markup extension attribute. It should begin with '{{', but was {0}", raw);
            }
            var ret = new ParsedMarkupExtensionInfo();
            int idx = raw.IndexOf('}');

            if (idx < 0)
            {
                throw Error("Expected '}}' in the markup extension attribute: '{0}'", raw);
            }
            raw = raw.Substring(1, idx - 1);
            idx = raw.IndexOf(' ');
            string name = idx < 0 ? raw : raw.Substring(0, idx);

            XamlTypeName xtn;

            if (!XamlTypeName.TryParse(name, nsResolver, out xtn))
            {
                throw Error("Failed to parse type name '{0}'", name);
            }
            var xt = sctx.GetXamlType(xtn);

            ret.Type = xt;

            if (idx < 0)
            {
                return(ret);
            }

            string []     vpairs  = raw.Substring(idx + 1, raw.Length - idx - 1).Split(',');
            List <string> posPrms = null;

            foreach (string vpair in vpairs)
            {
                idx = vpair.IndexOf('=');
                // FIXME: unescape string (e.g. comma)
                if (idx < 0)
                {
                    if (posPrms == null)
                    {
                        posPrms = new List <string> ();
                        ret.Arguments.Add(XamlLanguage.PositionalParameters, posPrms);
                    }
                    posPrms.Add(UnescapeValue(vpair.Trim()));
                }
                else
                {
                    var key = vpair.Substring(0, idx).Trim();
                    // FIXME: is unknown member always isAttacheable = false?
                    var xm = xt.GetMember(key) ?? new XamlMember(key, xt, false);
                    ret.Arguments.Add(xm, UnescapeValue(vpair.Substring(idx + 1).Trim()));
                }
            }
            return(ret);
        }
Exemple #13
0
        private IEnumerable <XamlNode> LogicStream_CheckForStartGetCollectionFromMember()
        {
            XamlType   currentType     = _context.CurrentType;
            XamlMember currentProperty = _context.CurrentMember;

            XamlType propertyType = currentProperty.Type;

            XamlType valueElementType = (_xamlScanner.NodeType == ScannerNodeType.TEXT)
                            ? XamlLanguage.String
                            : _xamlScanner.Type;

            if (propertyType.IsArray && _xamlScanner.Type != ArrayExtensionType)
            {
                IEnumerable <NamespaceDeclaration> newNamespaces = null;
                XamlTypeName           typeName       = new XamlTypeName(propertyType.ItemType);
                INamespacePrefixLookup prefixResolver = new NamespacePrefixLookup(out newNamespaces, _context.FindNamespaceByPrefix);
                string typeNameString = typeName.ToString(prefixResolver);    // SideEffects!!! prefixResolver will populate newNamespaces

                foreach (NamespaceDeclaration nsDecl in newNamespaces)
                {
                    yield return(new XamlNode(XamlNodeType.NamespaceDeclaration, nsDecl));
                }
                yield return(Logic_StartObject(ArrayExtensionType, null));

                _context.CurrentInImplicitArray = true;
                yield return(Logic_StartMember(ArrayTypeMember));

                yield return(new XamlNode(XamlNodeType.Value, typeNameString));

                yield return(Logic_EndMember());

                yield return(Logic_EndOfAttributes());

                yield return(Logic_StartMember(ItemsTypeMember));

                currentType     = _context.CurrentType;
                currentProperty = _context.CurrentMember;
                propertyType    = currentProperty.Type;
            }

            // Now Consider inserting special preamble to "Get" the collection:
            //   . GO
            //   . . SM _items
            if (!currentProperty.IsDirective && (propertyType.IsCollection || propertyType.IsDictionary))
            {
                bool emitPreamble = false;

                // If the collection property is Readonly then "Get" the collection.
                if (currentProperty.IsReadOnly || !_context.CurrentMemberIsWriteVisible())
                {
                    emitPreamble = true;
                }
                // If the collection is R/W and there is a type converter and we have Text
                // use the type converter rather than the GO; SM _items;
                else if (propertyType.TypeConverter != null && !currentProperty.IsReadOnly &&
                         _xamlScanner.NodeType == ScannerNodeType.TEXT)
                {
                    emitPreamble = false;
                }
                // Or if the Value (this is the first value in the collection)
                // isn't assignable to the Collection then "Get" the collection.
                else if (valueElementType == null || !valueElementType.CanAssignTo(propertyType))
                {
                    if (valueElementType != null)
                    {
                        // Unless: the Value is a Markup extension, in which case it is
                        // assumed that the ProvideValue() type will be AssignableFrom
                        // or If the next object has an x:Key in which case it must be
                        // a dictionary entry.
                        // so Don't "Get" the collection.
                        if (!valueElementType.IsMarkupExtension || _xamlScanner.HasKeyAttribute)
                        {
                            emitPreamble = true;
                        }
                        // Except: the Array Extension can never return a dictionary
                        // so for Array Extension do "Get" the collection.
                        // Note Array Extension would be suitable for List Collections
                        // Note: a fully validating parser should look at MarkupExtensionReturnType
                        // for this choice, there might be other MarkupExtensions that fit this.
                        else if (valueElementType == XamlLanguage.Array)
                        {
                            emitPreamble = true;
                        }
                    }
                }
                if (emitPreamble)
                {
                    yield return(Logic_StartGetObjectFromMember(propertyType));

                    yield return(Logic_StartItemsProperty(propertyType));
                }
            }
        }
        public static ParsedMarkupExtensionInfo Parse(string raw, IXamlNamespaceResolver nsResolver, XamlSchemaContext sctx)
        {
            if (raw == null)
            {
                throw new ArgumentNullException(nameof(raw));
            }

            if (raw.Length == 0 || raw[0] != '{')
            {
                throw Error("Invalid markup extension attribute. It should begin with '{{', but was {0}", raw);
            }

            var ret = new ParsedMarkupExtensionInfo();
            int idx = raw.LastIndexOf('}');

            if (idx < 0)
            {
                throw Error("Expected '}}' in the markup extension attribute: '{0}'", raw);
            }

            raw = raw.Substring(1, idx - 1);
            idx = raw.IndexOf(' ');
            string name = idx < 0 ? raw : raw.Substring(0, idx);

            XamlTypeName xtn;

            if (!XamlTypeName.TryParse(name, nsResolver, out xtn))
            {
                throw Error("Failed to parse type name '{0}'", name);
            }

            var xt = sctx.GetXamlType(xtn) ?? new XamlType(nsResolver.GetNamespace(""), name, null, sctx);

            ret.Type = xt;

            if (idx < 0)
            {
                return(ret);
            }

            var valueWithoutBinding = raw.Substring(idx + 1, raw.Length - idx - 1);

            var vpairs = BindingMembersRegex.Matches(valueWithoutBinding)
                         .Cast <Match>()
                         .Select(m => m.Value.Trim())
                         .ToList();

            if (vpairs.Count == 0)
            {
                vpairs.Add(valueWithoutBinding);
            }

            List <string> posPrms = null;

            foreach (var vpair in vpairs)
            {
                idx = vpair.IndexOf('=');

                // FIXME: unescape string (e.g. comma)
                if (idx < 0)
                {
                    if (posPrms == null)
                    {
                        posPrms = new List <string>();
                        ret.Arguments.Add(XamlLanguage.PositionalParameters, posPrms);
                    }

                    posPrms.Add(UnescapeValue(vpair.Trim()));
                }
                else
                {
                    var key = vpair.Substring(0, idx).Trim();
                    // FIXME: is unknown member always isAttacheable = false?
                    var xm = xt.GetMember(key) ?? new XamlMember(key, xt, false);

                    // Binding member values may be wrapped in quotes (single or double) e.g. 'A,B,C,D'.
                    // Remove those wrapping quotes from the resulting string value.
                    var valueString = RemoveWrappingStringQuotes(vpair.Substring(idx + 1).Trim());

                    var value = IsValidMarkupExtension(valueString)
                                                ? (object)Parse(valueString, nsResolver, sctx) : UnescapeValue(valueString);

                    ret.Arguments.Add(xm, value);
                }
            }
            return(ret);
        }
		public void ToStringNamespaceLookupInsufficient ()
		{
			var n = new XamlTypeName ("urn:foo", "Foo", new XamlTypeName [] {new XamlTypeName ("urn:bar", "Bar"), new XamlTypeName ("urn:baz", "Baz")});
			var lookup = new MyNamespaceLookup ();
			lookup.Add ("a", "urn:foo");
			lookup.Add ("c", "urn:baz");
			// it fails because there is missing mapping for urn:bar.
			Assert.Throws<InvalidOperationException> (() => n.ToString (lookup), "#1");
		}
Exemple #16
0
        public void ConstructorDefault()
        {
            var xtn = new XamlTypeName();

            Assert.IsNotNull(xtn.TypeArguments, "#1");
        }
Exemple #17
0
 internal XamlType GetXamlType (XamlTypeName typeName)
 {
     return this.GetXamlType(typeName, false, false);
 }
Exemple #18
0
 internal XamlType GetXamlType(XamlTypeName typeName, bool returnUnknownTypesOnFailure)
 {
     return(GetXamlType(typeName, returnUnknownTypesOnFailure, false));
 }
		public void GetAbstractTypeFromClrNamespace()
		{
			var ctx = new XamlSchemaContext();
			var tn = new XamlTypeName(Compat.TestAssemblyNamespace, "AbstractObject");
			var xt = ctx.GetXamlType(tn);
			Assert.IsNotNull(xt, "#1");
			Assert.IsNotNull(xt.UnderlyingType, "#2");
		}
Exemple #20
0
        /// <summary>
        /// Resolves a property of the form 'Foo.Bar' or 'a:Foo.Bar', in
        /// in the context of a parent tag.  The parent tagType may or may not
        /// be covariant with the ownerType.  In the case of dotted attribute
        /// syntax, the namespace my be passed in.
        /// </summary>
        /// <param name="tagType">The xamlType of the enclosing Tag</param>
        /// <param name="tagNamespace">The namespace of the enclosing Tag</param>
        /// <param name="propName">The dotted name of the property</param>
        /// <param name="tagIsRoot">Whether the tag is the root of the document</param>
        /// <returns></returns>
        public XamlMember GetDottedProperty(XamlType tagType, string tagNamespace, XamlPropertyName propName, bool tagIsRoot)
        {
            if (tagType == null)
            {
                throw new XamlInternalException(SR.Get(SRID.ParentlessPropertyElement, propName.ScopedName));
            }
            XamlMember property  = null;
            XamlType   ownerType = null;
            string     ns        = ResolveXamlNameNS(propName);

            if (ns == null)
            {
                throw new XamlParseException(SR.Get(SRID.PrefixNotFound, propName.Prefix));
            }
            XamlType rootTagType = tagIsRoot ? tagType : null;

            // If we have <foo x:TA="" foo.bar=""/> we want foo in foo.bar to match the tag
            // type since there is no way to specify generic syntax in dotted property notation
            // If that fails, then we fall back to the non-generic case below.
            bool ownerTypeMatchesGenericTagType = false;

            if (tagType.IsGeneric)
            {
                ownerTypeMatchesGenericTagType = PropertyTypeMatchesGenericTagType(tagType, tagNamespace, ns, propName.OwnerName);
                if (ownerTypeMatchesGenericTagType)
                {
                    property = GetInstanceOrAttachableProperty(tagType, propName.Name, rootTagType);
                    if (property != null)
                    {
                        return(property);
                    }
                }
            }

            // Non-generic case, just resolve using the namespace and name
            XamlTypeName ownerTypeName = new XamlTypeName(ns, propName.Owner.Name);

            ownerType = this.GetXamlType(ownerTypeName, true);
            bool canAssignTagTypeToOwnerType = tagType.CanAssignTo(ownerType);

            if (canAssignTagTypeToOwnerType)
            {
                property = GetInstanceOrAttachableProperty(ownerType, propName.Name, rootTagType);
            }
            else
            {
                property = this.GetXamlAttachableProperty(ownerType, propName.Name);
            }
            if (property == null)
            {
                // This is an unknown property.
                // We don't know for sure whether or not it's attachable, so we go with our best guess.
                // If the owner type is same as the generic tag type, or is assignable to the tag type,
                // it's probably not attachable.
                XamlType declaringType = ownerTypeMatchesGenericTagType ? tagType : ownerType;
                if (ownerTypeMatchesGenericTagType || canAssignTagTypeToOwnerType)
                {
                    property = CreateUnknownMember(declaringType, propName.Name);
                }
                else
                {
                    property = CreateUnknownAttachableMember(declaringType, propName.Name);
                }
            }
            return(property);
        }
Exemple #21
0
        private IEnumerable<XamlAttribute> ReadObjectElementObject(string xmlns, string name, ProtoParserNode node, List<UnboundAttribute> xamlBareAttributes)
        {
            var xamlTypeName = new XamlTypeName(xmlns, name);
            node.Type = typingCore.GetWithFullAddress(xamlTypeName);

            var attributes = GetAttributes(xamlBareAttributes, node.Type).ToList();

            if (stack.Depth > 0)
            {
                stack.IsCurrentlyInsideContent = true;
            }

            if (!node.IsEmptyTag)
            {
                node.NodeType = NodeType.Element;
                stack.Push(node.Type, node.TypeNamespace);
            }
            else
            {
                node.NodeType = NodeType.EmptyElement;
            }

            return attributes;
        }
Exemple #22
0
        XamlType ResolveTypeFromName(string name)
        {
            var nsr = (IXamlNamespaceResolver)service_provider.GetService(typeof(IXamlNamespaceResolver));

            return(sctx.GetXamlType(XamlTypeName.Parse(name, nsr)));
        }
		public void ToStringNamespaceNull ()
		{
			// allowed.
			var n = new XamlTypeName (null, "FooBar");
			n.ToString ();
		}
Exemple #24
0
        public void ToStringDefault()
        {
            var n = new XamlTypeName();

            n.ToString();
        }
		public void ToStringEmptyNamespace ()
		{
			var n = new XamlTypeName (string.Empty, "Foo");
			Assert.AreEqual ("{}Foo", n.ToString (), "#1");
		}
Exemple #26
0
        public void ToStringNameNull()
        {
            var n = new XamlTypeName("urn:foo", null);

            n.ToString();
        }
		public void ToStringNamespaceLookup ()
		{
			var n = new XamlTypeName ("urn:foo", "Foo", new XamlTypeName [] {new XamlTypeName ("urn:bar", "Bar"), new XamlTypeName ("urn:baz", "Baz")});
			var lookup = new MyNamespaceLookup ();
			lookup.Add ("a", "urn:foo");
			lookup.Add ("b", "urn:bar");
			lookup.Add ("c", "urn:baz");
			Assert.AreEqual ("a:Foo(b:Bar, c:Baz)", n.ToString (lookup), "#1");
			Assert.AreEqual ("b:Bar, c:Baz", XamlTypeName.ToString (n.TypeArguments, lookup), "#2");
		}
Exemple #28
0
        public void ToStringTypeArgumentsNull()
        {
            var n = new XamlTypeName("urn:foo", "FooBar", (XamlTypeName [])null);

            Assert.AreEqual("{urn:foo}FooBar", n.ToString(), "#1");
        }
		public void ConstructorTypeArgumentsNull ()
		{
			var n = new XamlTypeName ("urn:foo", "FooBar", (XamlTypeName []) null);
			Assert.IsNotNull (n.TypeArguments, "#1");
			Assert.AreEqual (0, n.TypeArguments.Count, "#2");
		}
Exemple #30
0
        public void ToStringTypeArgumentsNullEntry()
        {
            var n = new XamlTypeName("urn:foo", "FooBar", new XamlTypeName [] { null, new XamlTypeName("urn:bar", "FooBarBaz") });

            Assert.AreEqual("{urn:foo}FooBar()", n.ToString(), "#1");
        }
Exemple #31
0
 public void ParseListInvalid3()
 {
     XamlTypeName.ParseList("", new MyNSResolver());
 }
Exemple #32
0
        public void ToStringTypeArguments2()
        {
            var n = new XamlTypeName("urn:foo", "Foo", new XamlTypeName [] { new XamlTypeName("urn:bar", "Bar"), new XamlTypeName("urn:baz", "Baz") });

            Assert.AreEqual("{urn:foo}Foo({urn:bar}Bar, {urn:baz}Baz)", n.ToString(), "#1");
        }
 public XamlType GetByFullAddress(XamlTypeName xamlTypeName)
 {
     return TypeRepository.GetByFullAddress(xamlTypeName);
 }
Exemple #34
0
        public void ToStringEmptyNamespace()
        {
            var n = new XamlTypeName(string.Empty, "Foo");

            Assert.AreEqual("{}Foo", n.ToString(), "#1");
        }
Exemple #35
0
 internal XamlType GetXamlType (XamlTypeName typeName, bool returnUnknownTypesOnFailure)
 {
     return this.GetXamlType(typeName, returnUnknownTypesOnFailure, false);
 }
Exemple #36
0
        public void ToStringXamlTypePredefined()
        {
            var n = new XamlTypeName(XamlLanguage.Int32);

            Assert.AreEqual("{http://schemas.microsoft.com/winfx/2006/xaml}Int32", n.ToString(), "#1");
        }
Exemple #37
0
        public void ToStringNullLookup()
        {
            var n = new XamlTypeName("urn:foo", "Foo", new XamlTypeName [] { new XamlTypeName("urn:bar", "Bar"), new XamlTypeName("urn:baz", "Baz") });

            Assert.AreEqual("{urn:foo}Foo({urn:bar}Bar, {urn:baz}Baz)", n.ToString(null), "#1");
        }
Exemple #38
0
 public void StaticToStringNullLookup()
 {
     XamlTypeName.ToString(new XamlTypeName [] { new XamlTypeName("urn:foo", "bar") }, null);
 }
		public void GetAbstractTypeFromUriNamespace()
		{
			var ctx = new XamlSchemaContext();
			var tn = new XamlTypeName("urn:mono-test", "AbstractObject");
			var xt = ctx.GetXamlType(tn);
			Assert.IsNotNull(xt, "#1");
			Assert.IsNotNull(xt.UnderlyingType, "#2");
		}
Exemple #40
0
 public void StaticToStringNullTypeNameList()
 {
     XamlTypeName.ToString(null, new MyNamespaceLookup());
 }
Exemple #41
0
        private XamlMember GetDottedProperty(XamlType tagType, PropertyLocator propLocator)
        {
            if (tagType == null)
            {
                throw new ArgumentNullException(nameof(tagType));
            }

            var xamlNamespace = ResolveXamlNameNs(propLocator);
            if (xamlNamespace == null)
            {
                throw new XamlParseException("PrefixNotFound");
            }

            var xamlTypeName = new XamlTypeName(xamlNamespace, propLocator.Owner.PropertyName);
            var xamlType = typingCore.GetWithFullAddress(xamlTypeName);
            return xamlType.GetMember(propLocator.PropertyName);
        }
Exemple #42
0
 public void StaticToStringEmptyArray()
 {
     Assert.AreEqual("", XamlTypeName.ToString(new XamlTypeName [0], new MyNamespaceLookup()), "#1");
 }
Exemple #43
0
 public XamlType GetWithFullAddress(XamlTypeName xamlTypeName)
 {
     return typeRepository.GetWithFullAddress(xamlTypeName);
 }
Exemple #44
0
 public void TryParseNullName()
 {
     XamlTypeName.TryParse(null, new MyNSResolver(), out dummy);
 }
		public void ToStringNameNull ()
		{
			var n = new XamlTypeName ("urn:foo", null);
			n.ToString ();
		}
Exemple #46
0
 public void TryParseNullResolver()
 {
     XamlTypeName.TryParse("Foo", null, out dummy);
 }
		public void ToStringTypeArgumentsNull ()
		{
			var n = new XamlTypeName ("urn:foo", "FooBar", (XamlTypeName []) null);
			Assert.AreEqual ("{urn:foo}FooBar", n.ToString (), "#1");
		}
Exemple #48
0
 public void TryParseEmptyName()
 {
     Assert.IsFalse(XamlTypeName.TryParse(String.Empty, new MyNSResolver(), out dummy), "#1");
 }
		public void ToStringTypeArguments2 ()
		{
			var n = new XamlTypeName ("urn:foo", "Foo", new XamlTypeName [] {new XamlTypeName ("urn:bar", "Bar"), new XamlTypeName ("urn:baz", "Baz")});
			Assert.AreEqual ("{urn:foo}Foo({urn:bar}Bar, {urn:baz}Baz)", n.ToString (), "#1");
		}
Exemple #50
0
 public void TryParseNoFillEmpty()
 {
     Assert.IsFalse(XamlTypeName.TryParse("Foo", new MyNSResolver(true), out dummy), "#1");
 }
		public void ToStringXamlTypePredefined ()
		{
			var n = new XamlTypeName (XamlLanguage.Int32);
			Assert.AreEqual ("{http://schemas.microsoft.com/winfx/2006/xaml}Int32", n.ToString (), "#1");
		}
Exemple #52
0
 public void TryParseAlreadyQualified()
 {
     Assert.IsFalse(XamlTypeName.TryParse("{urn:foo}Foo", new MyNSResolver(), out dummy), "#1");
 }
		public void ToStringNullLookup ()
		{
			var n = new XamlTypeName ("urn:foo", "Foo", new XamlTypeName [] {new XamlTypeName ("urn:bar", "Bar"), new XamlTypeName ("urn:baz", "Baz")});
			Assert.AreEqual ("{urn:foo}Foo({urn:bar}Bar, {urn:baz}Baz)", n.ToString (null), "#1");
		}
Exemple #54
0
 public void TryParseResolveFailure()
 {
     Assert.IsFalse(XamlTypeName.TryParse("x:Foo", new MyNSResolver(), out dummy), "#1");
 }
		public void ConstructorDefault ()
		{
			var xtn = new XamlTypeName ();
			Assert.IsNotNull (xtn.TypeArguments, "#1");
		}
Exemple #56
0
 public void ParseListNullNames()
 {
     XamlTypeName.ParseList(null, new MyNSResolver());
 }
		public void ConstructorNamespaceNull ()
		{
			// allowed.
			var xtn = new XamlTypeName (null, "FooBar");
			Assert.IsNotNull (xtn.TypeArguments, "#1");
		}
Exemple #58
0
 public void ParseListNullResolver()
 {
     XamlTypeName.ParseList("foo", null);
 }
		public void ConstructorTypeArgumentsNullEntry()
		{
			if (!Compat.IsPortableXaml)
				Assert.Ignore(".NET causes NRE on ToString().It is not really intended and should raise an error when constructed");
			var type = new XamlTypeName("urn:foo", "FooBar", new XamlTypeName[] { null });
			Assert.DoesNotThrow(() => type.ToString());
		}
		public void ToStringNamespaceNull ()
		{
			// allowed.
			var n = new XamlTypeName (null, "FooBar");
			Assert.Throws<InvalidOperationException> (() => n.ToString ());
		}