Example #1
0
        public void GetTemplateNames_should_obtain_names_nominal()
        {
            IEnumerable <QualifiedName> names = App.GetTemplateNames(typeof(StatusBuilder));

            Assert.Contains(NamespaceUri.Parse("http://ns.example.com/2012") + "A", names);
            Assert.Contains(NamespaceUri.Parse("http://ns.example.com/2012") + "B", names);
        }
Example #2
0
        public void GetTemplateName_should_be_reflexive_from_FromName()
        {
            var name = NamespaceUri.Parse("http://ns.example.com/2012").GetName("A");
            Template <StatusBuilder> a = Template.FromName <StatusBuilder>(name);

            Assert.Equal(name, Template.GetTemplateName(a));
        }
Example #3
0
        public void FromName_should_create_from_type_and_qualified_name()
        {
            Template <StatusBuilder> a = Template.FromName <StatusBuilder>(NamespaceUri.Parse("http://ns.example.com/2012").GetName("A"));
            var sb = a.CreateInstance();

            Assert.Equal(4, sb.ErrorCode);
        }
Example #4
0
        public void GetXmlNamespace_should_get_xmlns_from_clrnamespaces()
        {
            AssemblyInfo ai = AssemblyInfo.GetAssemblyInfo(typeof(TypeReference).GetTypeInfo().Assembly);

            Assert.Equal(NamespaceUri.Parse(Xmlns.Core2008), ai.GetXmlNamespace("Carbonfrost.Commons.Core"));
            Assert.Equal(NamespaceUri.Parse(Xmlns.Core2008), ai.GetXmlNamespace("Carbonfrost.Commons.Core.Runtime"));
        }
Example #5
0
        public void XmlNamespaces_should_get_known_namespaces()
        {
            Assembly a    = typeof(TypeReference).GetTypeInfo().Assembly;
            var      info = AssemblyInfo.GetAssemblyInfo(a);

            Assert.Equal(new [] {
                NamespaceUri.Parse(Xmlns.Core2008)
            }, info.XmlNamespaces.ToArray());
        }
Example #6
0
        public void GetXmlNamespaces_should_get_clr_namespaces_from_xmlns()
        {
            AssemblyInfo ai  = AssemblyInfo.GetAssemblyInfo(typeof(TypeReference).GetTypeInfo().Assembly);
            var          all = ai.GetClrNamespaces(NamespaceUri.Parse(Xmlns.Core2008));

            Assert.Contains("Carbonfrost.Commons.Core", all);
            Assert.Contains("Carbonfrost.Commons.Core.Runtime", all);

            Assert.DoesNotContain("Carbonfrost.Commons.ComponentModel.Annotations", all);
        }
        public override object ConvertFromString(string text, Type destinationType, IValueSerializerContext context)
        {
            var s = text;

            if (s != null)
            {
                return(NamespaceUri.Parse(s));
            }

            return(base.ConvertFromString(text, destinationType, context));
        }