示例#1
0
        public void AnnotateProperty()
        {
            var target = new ClassA();

            target.Annotate(() => target.FirstName, Suffix => "Mr");
            Assert.AreEqual("Mr", target.Annotation <string>(() => target.FirstName, "Suffix"));
        }
 public void AnnotateNonOwnedProperty()
 {
     var targetA = new ClassA();
     var targetB = new ClassB();
     targetA.Annotate(() => targetB.FirstName, Suffix => "Mr");
     Assert.AreEqual("Mr", targetA.Annotation<string>(() => targetB.FirstName, "Suffix"));
 }
示例#3
0
        public void AnnotateClass()
        {
            var target = new ClassA();

            target.Annotate(Description => "instance we are testing");
            Assert.AreEqual("instance we are testing", target.Annotation <string>("Description"));
        }
示例#4
0
        public void AnnotateNonOwnedProperty()
        {
            var targetA = new ClassA();
            var targetB = new ClassB();

            targetA.Annotate(() => targetB.FirstName, Suffix => "Mr");
            Assert.AreEqual("Mr", targetA.Annotation <string>(() => targetB.FirstName, "Suffix"));
        }
示例#5
0
        public void QueryStoreForMemberAnnotations()
        {
            var target1 = new ClassA();
            var target2 = new ClassA();
            var target3 = new ClassA();

            target1.Annotate(() => target1.FirstName, CamelCase => true); // annotating a property
            target1.Annotate(() => target1.Field, Ignored => true);       // annotating a field
            target2.Annotate(() => target2.Execute(), Parsed => true);    // annotating a method

            target3.Annotate(Parsed => true);

            List <MemberAnnotation> results = AnnotationStore.Members
                                              .Where(p => p.HasKey("CamelCase"))
                                              .ToList();

            Assert.AreEqual(1, results.Count);
        }
示例#6
0
        public void AnnotateDifferentInstances()
        {
            var target1 = new ClassA();
            var target2 = new ClassA();

            target1.Annotate(Description => "class number 1");
            target2.Annotate(Description => "class number 2");

            Assert.AreEqual("class number 1", target1.Annotation <string>("Description"));
            Assert.AreEqual("class number 2", target2.Annotation <string>("Description"));
        }
        public void AnnotateDifferentInstances()
        {
            var target1 = new ClassA();
            var target2 = new ClassA();

            target1.Annotate(Description => "class number 1");
            target2.Annotate(Description => "class number 2");

            Assert.AreEqual("class number 1", target1.Annotation<string>("Description"));
            Assert.AreEqual("class number 2", target2.Annotation<string>("Description"));
        }
示例#8
0
        public void QueryStoreForClassAnnotationsWithCertainKey()
        {
            var target1 = new ClassA();
            var target2 = new ClassA();
            var target3 = new ClassA();

            target1.Annotate(Description => "class number 1");
            target2.Annotate(Description => "class number 2");
            target3.Annotate(Parsed => true);

            List <ClassAnnotation> results = AnnotationStore.Classes
                                             .Where(a => a.HasKey("Description"))
                                             .ToList();

            Assert.AreEqual(2, results.Count);
        }
        public void QueryStoreForClassAnnotationsWithCertainKey()
        {
            var target1 = new ClassA();
            var target2 = new ClassA();
            var target3 = new ClassA();

            target1.Annotate(Description => "class number 1");
            target2.Annotate(Description => "class number 2");
            target3.Annotate(Parsed => true);

            List<ClassAnnotation> results = AnnotationStore.Classes
                .Where(a => a.HasKey("Description"))
                .ToList();

            Assert.AreEqual(2, results.Count);
        }
        public void QueryStoreForMemberAnnotations()
        {
            var target1 = new ClassA();
            var target2 = new ClassA();
            var target3 = new ClassA();

            target1.Annotate(() => target1.FirstName, CamelCase => true); // annotating a property
            target1.Annotate(() => target1.Field, Ignored => true); // annotating a field
            target2.Annotate(() => target2.Execute(), Parsed => true); // annotating a method

            target3.Annotate(Parsed => true);

            List<MemberAnnotation> results = AnnotationStore.Members
                .Where(p => p.HasKey("CamelCase"))
                .ToList();

            Assert.AreEqual(1, results.Count);
        }
 public void AnnotateProperty()
 {
     var target = new ClassA();
     target.Annotate(() => target.FirstName, Suffix => "Mr");
     Assert.AreEqual("Mr", target.Annotation<string>(() => target.FirstName, "Suffix"));
 }
 public void AnnotateClass()
 {
     var target = new ClassA();
     target.Annotate(Description => "instance we are testing");
     Assert.AreEqual("instance we are testing", target.Annotation<string>("Description"));
 }