public void AddAnnotationWithSameClassNameButDifferentNamespace(XObject xo) { DifferentNamespace.A a1 = new DifferentNamespace.A(); A a2 = new A(); xo.AddAnnotation(a1); xo.AddAnnotation(a2); ValidateAnnotations(xo, new DifferentNamespace.A[] { a1 }); ValidateAnnotations(xo, new A[] { a2 }); Assert.Equal(a1, xo.Annotation <DifferentNamespace.A>()); Assert.Equal(a1, (DifferentNamespace.A)xo.Annotation(typeof(DifferentNamespace.A))); Assert.Equal(a2, xo.Annotation <A>()); Assert.Equal(a2, (A)xo.Annotation(typeof(A))); }
public void RemoveAnnotationWithSameClassNameButDifferentNamespace(XObject xo) { DifferentNamespace.A a1 = new DifferentNamespace.A(); A a2 = new A(); xo.AddAnnotation(a1); xo.AddAnnotation(a2); xo.RemoveAnnotations <DifferentNamespace.A>(); Assert.Equal(expected: 0, actual: CountAnnotations <DifferentNamespace.A>(xo)); ValidateAnnotations <A>(xo, new A[] { a2 }); Assert.Equal(a2, xo.Annotation <A>()); Assert.Equal(a2, (A)xo.Annotation(typeof(A))); xo.RemoveAnnotations(typeof(A)); Assert.Equal(expected: 0, actual: CountAnnotations <A>(xo)); }
//[Variation(Priority = 0, Desc = "Add annotation with same class name but different namespace")] public void Annotations_15() { DifferentNamespace.A a1 = new DifferentNamespace.A(); A a2 = new A(); foreach (XObject xo in GetXObjects()) { xo.AddAnnotation(a1); xo.AddAnnotation(a2); ValidateAnnotations <DifferentNamespace.A>(xo, new DifferentNamespace.A[] { a1 }); ValidateAnnotations <A>(xo, new A[] { a2 }); TestLog.Compare(xo.Annotation <DifferentNamespace.A>(), a1, "Validation failed"); TestLog.Compare((DifferentNamespace.A)xo.Annotation(typeof(DifferentNamespace.A)), a1, "Validation failed"); TestLog.Compare(xo.Annotation <A>(), a2, "Validation failed"); TestLog.Compare((A)xo.Annotation(typeof(A)), a2, "Validation failed"); } }
//[Variation(Priority = 0, Desc = "Remove annotation with same class name but different namespace")] public void Annotations_16() { DifferentNamespace.A a1 = new DifferentNamespace.A(); A a2 = new A(); foreach (XObject xo in GetXObjects()) { xo.AddAnnotation(a1); xo.AddAnnotation(a2); xo.RemoveAnnotations <DifferentNamespace.A>(); TestLog.Compare(CountAnnotations <DifferentNamespace.A>(xo), 0, "unexpected number of annotations"); ValidateAnnotations <A>(xo, new A[] { a2 }); TestLog.Compare(xo.Annotation <A>(), a2, "Validation failed"); TestLog.Compare((A)xo.Annotation(typeof(A)), a2, "Validation failed"); xo.RemoveAnnotations(typeof(A)); TestLog.Compare(CountAnnotations <A>(xo), 0, "unexpected number of annotations"); } }