Esempio n. 1
0
        public void Add_should_verify_builtin_prefixes()
        {
            var c   = new HxlNamespaceCollection();
            var uri = new Uri("http://example.com");

            Assert.Throws <ArgumentException>(() => c.AddNew("xml", uri));
            Assert.Throws <ArgumentException>(() => c.AddNew("hxl", uri));
            Assert.Throws <ArgumentException>(() => c.AddNew("c", uri));
            Assert.Throws <ArgumentException>(() => c.AddNew("xmlns", uri));
        }
Esempio n. 2
0
        public void LookupNamespace_should_resolve_trivial()
        {
            var c   = new HxlNamespaceCollection();
            var uri = new Uri("http://example.com");

            c.AddNew("e", uri);
            Assert.Equal(uri, c.LookupNamespace("e"));
        }
        public void CreateAttribute_should_lookup_provider()
        {
            var infos = App.DescribeProviders().GetProviderInfos(typeof(HxlAttribute))
                        .ToArray();

            var p          = new ProviderDomNodeFactory();
            var collection = new HxlNamespaceCollection();

            collection.AddNew("test", new Uri("http://example.com/"));
            ((IHxlDomNodeFactory)p).SetResolver(collection);

            // test: prefix gets picked up within dom creation
            var attr = p.CreateAttribute("test:My");

            Assert.IsInstanceOf <MyAttributeFragment>(attr);
            Assert.Equal("test:my", attr.Name);
        }