public void CanGetExistingAttributeForTheFirstTime() { MockAttribute attribute = cache.GetCustomAttribute <MockAttribute>(typeof(TypeWithMockAttributeA)); Assert.IsNotNull(attribute); Assert.AreEqual(1, attribute.value); }
public void CanGetNonExistingAttributeForTheSecondTime() { cache.GetCustomAttribute <MockAttribute>(typeof(TypeWithoutMockAttribute)); MockAttribute attribute = cache.GetCustomAttribute <MockAttribute>(typeof(TypeWithoutMockAttribute)); Assert.IsNull(attribute); }
public void CanGetInheritedAttributeForTheFirstTimeWithInheritance() { MockAttribute attribute = cache.GetCustomAttribute <MockAttribute>(typeof(TypeWithInheritedMockAttribute), true); Assert.IsNotNull(attribute); Assert.AreEqual(1, attribute.value); }
public void CanGetExistingAttributeForTheSecondTimeWithInheritance() { cache.GetCustomAttribute <MockAttribute>(typeof(TypeWithMockAttributeA), true); MockAttribute attribute = cache.GetCustomAttribute <MockAttribute>(typeof(TypeWithMockAttributeA), true); Assert.IsNotNull(attribute); Assert.AreEqual(1, attribute.value); }
public void CanCacheSameAttributeForDifferentTypes() { MockAttribute attributeA = cache.GetCustomAttribute <MockAttribute>(typeof(TypeWithMockAttributeA)); Assert.IsTrue(cache.HasCachedCustomAttribute <MockAttribute>(typeof(TypeWithMockAttributeA))); Assert.IsFalse(cache.HasCachedCustomAttribute <MockAttribute>(typeof(TypeWithMockAttributeB))); MockAttribute attributeB = cache.GetCustomAttribute <MockAttribute>(typeof(TypeWithMockAttributeB)); Assert.IsTrue(cache.HasCachedCustomAttribute <MockAttribute>(typeof(TypeWithMockAttributeA))); Assert.IsTrue(cache.HasCachedCustomAttribute <MockAttribute>(typeof(TypeWithMockAttributeB))); Assert.AreEqual(1, attributeA.value); Assert.AreEqual(2, attributeB.value); }
public void GetsNullForInheritedAttributeForTheFirstTime() { MockAttribute attribute = cache.GetCustomAttribute <MockAttribute>(typeof(TypeWithInheritedMockAttribute)); Assert.IsNull(attribute); }
public void GetsNullForNonExistingAttributeForTheFirstTime() { MockAttribute attribute = cache.GetCustomAttribute <MockAttribute>(typeof(TypeWithoutMockAttribute)); Assert.IsNull(attribute); }