public void PolymorphicAnnotationsTest() { Annotation3 three = new Annotation3(); Annotation3Subtype threeSub = new Annotation3Subtype(); TestAnnotatable annotatable = new TestAnnotatable(); annotatable.SetAnnotation(three); annotatable.SetAnnotation(threeSub); // TODO: ckerer: call the combination engine with an annotatable where the entries are reversed! Annotation3 retrievedThree = annotatable.GetAnnotation <Annotation3>(); this.Assert.AreSame(three, retrievedThree, "Expected retrieved annotation to be reference equal with originally set one."); Annotation3Subtype retrievedThreeSub = annotatable.GetAnnotation <Annotation3Subtype>(); this.Assert.AreSame(threeSub, retrievedThreeSub, "Expected retrieved annotation to be reference equal with originally set one."); annotatable.SetAnnotation <Annotation3Subtype>(null); retrievedThreeSub = annotatable.GetAnnotation <Annotation3Subtype>(); this.Assert.IsNull(retrievedThreeSub, "Expected to not find an annotation of type Annotation3Subtype."); retrievedThree = annotatable.GetAnnotation <Annotation3>(); this.Assert.AreSame(three, retrievedThree, "Expected retrieved annotation to be reference equal with originally set one."); annotatable.SetAnnotation <Annotation3>(null); retrievedThree = annotatable.GetAnnotation <Annotation3>(); this.Assert.IsNull(retrievedThreeSub, "Expected to not find an annotation of type Annotation3Subtype."); }
public void PolymorphicAnnotationsTest() { Annotation3 three = new Annotation3(); Annotation3Subtype threeSub = new Annotation3Subtype(); TestAnnotatable annotatable = new TestAnnotatable(); annotatable.SetAnnotation(three); annotatable.SetAnnotation(threeSub); // TODO: ckerer: call the combination engine with an annotatable where the entries are reversed! Annotation3 retrievedThree = annotatable.GetAnnotation<Annotation3>(); this.Assert.AreSame(three, retrievedThree, "Expected retrieved annotation to be reference equal with originally set one."); Annotation3Subtype retrievedThreeSub = annotatable.GetAnnotation<Annotation3Subtype>(); this.Assert.AreSame(threeSub, retrievedThreeSub, "Expected retrieved annotation to be reference equal with originally set one."); annotatable.SetAnnotation<Annotation3Subtype>(null); retrievedThreeSub = annotatable.GetAnnotation<Annotation3Subtype>(); this.Assert.IsNull(retrievedThreeSub, "Expected to not find an annotation of type Annotation3Subtype."); retrievedThree = annotatable.GetAnnotation<Annotation3>(); this.Assert.AreSame(three, retrievedThree, "Expected retrieved annotation to be reference equal with originally set one."); annotatable.SetAnnotation<Annotation3>(null); retrievedThree = annotatable.GetAnnotation<Annotation3>(); this.Assert.IsNull(retrievedThreeSub, "Expected to not find an annotation of type Annotation3Subtype."); }