Пример #1
0
        public void MultipleAnnotationsTest()
        {
            // this triggers resizing the array (from 2 to 4 items) and filling it up to the last spot
            Annotation1 one   = new Annotation1();
            Annotation2 two   = new Annotation2();
            Annotation3 three = new Annotation3();
            Annotation4 four  = new Annotation4();

            TestAnnotatable annotatable = new TestAnnotatable();

            annotatable.SetAnnotation(one);
            annotatable.SetAnnotation(two);
            annotatable.SetAnnotation(three);
            annotatable.SetAnnotation(four);

            // TODO: ckerer: call the combination engine with an annotatable with 3 and 4 elements here!

            Annotation3 retrievedThree = annotatable.GetAnnotation <Annotation3>();

            this.Assert.AreSame(three, retrievedThree,
                                "Expected retrieved annotation to be reference equal with originally set one.");

            Annotation4 retrievedFour = annotatable.GetAnnotation <Annotation4>();

            this.Assert.AreSame(four, retrievedFour,
                                "Expected retrieved annotation to be reference equal with originally set one.");

            annotatable.SetAnnotation <Annotation3>(null);
            retrievedThree = annotatable.GetAnnotation <Annotation3>();
            this.Assert.IsNull(retrievedThree, "Expected to not find an annotation of type Annotation3.");

            retrievedFour = annotatable.GetAnnotation <Annotation4>();
            this.Assert.AreSame(four, retrievedFour,
                                "Expected retrieved annotation to be reference equal with originally set one.");

            annotatable.SetAnnotation <Annotation3>(null);
            retrievedThree = annotatable.GetAnnotation <Annotation3>();
            this.Assert.IsNull(retrievedThree, "Expected to not find an annotation of type Annotation3.");

            annotatable.SetAnnotation <Annotation4>(null);
            retrievedFour = annotatable.GetAnnotation <Annotation4>();
            this.Assert.IsNull(retrievedFour, "Expected to not find an annotation of type Annotation4.");
        }
Пример #2
0
        public void MultipleAnnotationsTest()
        {
            // this triggers resizing the array (from 2 to 4 items) and filling it up to the last spot
            Annotation1 one = new Annotation1();
            Annotation2 two = new Annotation2();
            Annotation3 three = new Annotation3();
            Annotation4 four = new Annotation4();

            TestAnnotatable annotatable = new TestAnnotatable();
            annotatable.SetAnnotation(one);
            annotatable.SetAnnotation(two);
            annotatable.SetAnnotation(three);
            annotatable.SetAnnotation(four);

            // TODO: ckerer: call the combination engine with an annotatable with 3 and 4 elements here!

            Annotation3 retrievedThree = annotatable.GetAnnotation<Annotation3>();
            this.Assert.AreSame(three, retrievedThree,
                "Expected retrieved annotation to be reference equal with originally set one.");

            Annotation4 retrievedFour = annotatable.GetAnnotation<Annotation4>();
            this.Assert.AreSame(four, retrievedFour,
                "Expected retrieved annotation to be reference equal with originally set one.");

            annotatable.SetAnnotation<Annotation3>(null);
            retrievedThree = annotatable.GetAnnotation<Annotation3>();
            this.Assert.IsNull(retrievedThree, "Expected to not find an annotation of type Annotation3.");

            retrievedFour = annotatable.GetAnnotation<Annotation4>();
            this.Assert.AreSame(four, retrievedFour,
                "Expected retrieved annotation to be reference equal with originally set one.");

            annotatable.SetAnnotation<Annotation3>(null);
            retrievedThree = annotatable.GetAnnotation<Annotation3>();
            this.Assert.IsNull(retrievedThree, "Expected to not find an annotation of type Annotation3.");

            annotatable.SetAnnotation<Annotation4>(null);
            retrievedFour = annotatable.GetAnnotation<Annotation4>();
            this.Assert.IsNull(retrievedFour, "Expected to not find an annotation of type Annotation4.");
        }