Пример #1
0
        public void Attributes_MethodHasOneAttribute_ReturnsOneAttribute()
        {
            CreatePublicFunction("MyClass.MyFunction");
            AddMethodAttribute("System.ObsoleteAttribute");

            global::EnvDTE.CodeElements attributes = codeFunction.Attributes;

            CodeAttribute2 attribute = attributes.FirstCodeAttribute2OrDefault();

            Assert.AreEqual(1, attributes.Count);
            Assert.AreEqual("System.ObsoleteAttribute", attribute.FullName);
        }
Пример #2
0
        public void Attributes_MethodHasOneAttribute_ReturnsOneAttribute()
        {
            CreateFunction(
                "using System;\r\n" +
                "public class MyClass {\r\n" +
                "    [Obsolete]\r\n" +
                "    public void MyFunction() {}\r\n" +
                "}");

            global::EnvDTE.CodeElements attributes = codeFunction.Attributes;

            CodeAttribute2 attribute = attributes.FirstCodeAttribute2OrDefault();

            Assert.AreEqual(1, attributes.Count);
            Assert.AreEqual("System.ObsoleteAttribute", attribute.FullName);
        }