public void when_adding_annotation_then_can_retrieve_it()
        {
            var annotated = new AnnotatedObject();

            annotated.AddAnnotation(new FooAnnotation());

            Assert.NotNull(annotated.Annotation<FooAnnotation>());
        }
        public void when_adding_second_annotation_then_state_becomes_array()
        {
            var annotated = new AnnotatedObject();

            annotated.AddAnnotation(new FooAnnotation());
            annotated.AddAnnotation(new BarAnnotation());

            Assert.IsType<object[]>(annotated.AnnotationState);
        }
        public void when_adding_annotation_then_state_equals_annotation()
        {
            var annotated = new AnnotatedObject();
            var annotation = new FooAnnotation();

            annotated.AddAnnotation(annotation);

            Assert.Same(annotation, annotated.AnnotationState);
        }
        public void when_adding_two_annotations_of_same_type_then_can_retrieve_them()
        {
            var annotated = new AnnotatedObject();

            annotated.AddAnnotation(new FooAnnotation());
            annotated.AddAnnotation(new BarAnnotation());
            annotated.AddAnnotation(new FooAnnotation());

            var annotations = annotated.Annotations<FooAnnotation>().ToList();

            Assert.Equal(2, annotations.Count);
        }
        public void when_last_annotation_removed_then_sets_state_to_null()
        {
            var annotated = new AnnotatedObject();

            annotated.AddAnnotation(new FooAnnotation());
            annotated.AddAnnotation(new BarAnnotation());

            annotated.RemoveAnnotations<FooAnnotation>();
            annotated.RemoveAnnotations<BarAnnotation>();

            Assert.Null(annotated.AnnotationState);
        }
        public void when_adding_two_annotations_then_can_retrieve_one()
        {
            var annotated = new AnnotatedObject();
            var annotation = new FooAnnotation();

            annotated.AddAnnotation(annotation);
            annotated.AddAnnotation(new BarAnnotation());

            Assert.Same(annotation, annotated.Annotation<FooAnnotation>());
        }