Example #1
0
        public void Test_AttachedProperty()
        {
            var type = GetTypeDef <AttachedTestClass>();
            var list = AttachedEntitiesHelper.GetAttachedEntities(type);

            Assert.AreEqual(3, list.Count());
        }
Example #2
0
        public void Test_NoEntities()
        {
            var type = GetTypeDef <AttachedTestClassNoAttachedEntities>();
            var list = AttachedEntitiesHelper.GetAttachedEntities(type);

            Assert.IsFalse(list.Any());
        }
Example #3
0
        public void Test_AttachedProperty_Property()
        {
            var type = GetTypeDef <AttachedPropertyTestClass>();

            Assert.AreEqual(1, type.Properties.Count(t => t.Name == "AttributeAttachProperty"));
            var list = AttachedEntitiesHelper.GetAttachedEntities(type);

            Assert.AreEqual("AttributeAttach", list.FirstOrDefault(t => t.Name == "AttributeAttach").Name);
        }
Example #4
0
        public void Test_AttachedProperty_Formatter_SetOnly()
        {
            string expected = "see SetSomeSet";

            var type = GetTypeDef <AttachedTestClass>();
            var list = AttachedEntitiesHelper.GetAttachedEntities(type);

            MemberFormatter formatter = new CSharpMemberFormatter();
            string          def       = formatter.GetDeclaration(list.Skip(2).First());

            Assert.AreEqual(expected, def);
        }