public void RemoveAnnotation_will_detach_node() { var doc = new DomDocument(); var anno = new FLifecycleAnnotation(); doc.CreateElement("a").RemoveAnnotation(anno); Assert.Equal(1, anno.DetachingCallCount); }
public void AddAnnotation_will_attach_node() { var doc = new DomDocument(); var anno = new FLifecycleAnnotation(); var element = doc.CreateElement("a").AddAnnotation(anno); Assert.Same(element, anno.LastAttachingArguments); Assert.Equal(1, anno.AttachingCallCount); }
public void DomObject_Clone_will_clone_annotations_copied_to_new_node() { var doc = new DomDocument(); var anno = new FLifecycleAnnotation(); var element = doc.CreateElement("a").AddAnnotation(anno); var clone = element.Clone(); Assert.NotNull(clone.Annotation <FLifecycleAnnotation>()); Assert.NotSame(anno, clone.Annotation <FLifecycleAnnotation>()); }
public void CopyAnnotationsFrom_will_process_lifecycle_events_on_clones() { var doc = new DomDocument(); var anno = new FLifecycleAnnotation(); var element = doc.CreateElement("a").AddAnnotation(anno); var clone = element.Clone(); var clonedAnnotation = clone.Annotation <FLifecycleAnnotation>(); Assume.NotNull(clonedAnnotation); Assert.Equal(1, clonedAnnotation.AttachingCallCount); Assert.Same(clone, clonedAnnotation.LastAttachingArguments); }