예제 #1
0
        public void FromType_generic_type_definition_nested_generic()
        {
            var      ti   = typeof(C <,> .D <,>).GetTypeInfo();
            TypeName name = TypeName.FromType(typeof(C <,> .D <,>));

            // proof, for reference:
            Assume.HasCount(4, ti.GetGenericArguments());
            Assume.Equal("D`2", ti.Name);
            Assume.Equal("Carbonfrost.UnitTests.DotNet.TypeNameTests+C`2+D`2", ti.FullName);

            Assert.True(name.IsGenericType);
            Assert.True(name.IsGenericTypeDefinition);
            Assert.Equal("Carbonfrost.UnitTests.DotNet.TypeNameTests+C`2+D`2", name.FullName);
            Assert.Equal(4, name.GenericParameterCount); // inherited generics
        }
예제 #2
0
        public void GetName_will_apply_name_context_comparer_when_it_changes()
        {
            var ele = new DomDocument().CreateElement("s");

            ele.NameContext = DomNameContext.Xml;

            var attr1 = ele.AppendAttribute("a", "b");
            var attr2 = ele.AppendAttribute("A", "B");

            Assume.HasCount(2, ele.Attributes);
            ele.NameContext = DomNameContext.Html;

            Assert.HasCount(1, ele.Attributes);
            Assert.Same(attr1, ele.Attributes[0]);

            Assert.True(attr2.IsUnlinked);
            Assert.Null(attr2.OwnerElement);
        }