public void GetAnnotation_KeyDoesNotExist() { var annotatable = new AnnotatableObject(); var key = new AnnotationKey <int>(); Assert.Equal(1, annotatable.GetAnnotation(key, () => 1)); }
public void RemoveAnnotation_KeyDoesNotExist() { var annotatable = new AnnotatableObject(); var key = new AnnotationKey <int>(); Assert.False(annotatable.RemoveAnnotation(key)); }
public void GetAnnotation_KeyDoesNotExist_NullInitializer() { var annotatable = new AnnotatableObject(); var key = new AnnotationKey <int>(); Assert.Equal(0, annotatable.GetAnnotation(key)); }
public void RemoveAnnotation_KeyExists() { var annotatable = new AnnotatableObject(); var key = new AnnotationKey <int>(); annotatable.SetAnnotation(key, 10); Assert.True(annotatable.RemoveAnnotation(key)); }
public void SetAnnotation_GetAnnotation() { var annotatable = new AnnotatableObject(); var key = new AnnotationKey <int>(); annotatable.SetAnnotation(key, 10); Assert.Equal(10, annotatable.GetAnnotation(key)); }
public void RemoveAnnotation_NullKey_ThrowsArgumentNullException() { var annotatable = new AnnotatableObject(); Assert.Throws <ArgumentNullException>(() => annotatable.RemoveAnnotation <int>(null !)); }
public void SetAnnotation_NullKey_ThrowsArgumentNullException() { var annotatable = new AnnotatableObject(); Assert.Throws <ArgumentNullException>(() => annotatable.SetAnnotation(null !, 1)); }