public void GetAttributeHandlesNull() { bool inherit = false; MockAttributeProvider provider = new MockAttributeProvider(null,inherit); object result = ReflectionHelper.GetAttribute<object>(provider, inherit); Assert.IsNull(result); }
public void GetAttributeHandlesNull() { const bool inherit = false; MockAttributeProvider provider = new MockAttributeProvider(null, inherit); object result = ReflectionHelper.GetAttribute <object>(provider, inherit); Assert.IsNull(result); }
public void GetAttributesHandlesNull() { bool inherit = false; MockAttributeProvider provider = new MockAttributeProvider(null, inherit); object[] result = ReflectionHelper.GetAttributes<object>(provider, inherit); Assert.IsNotNull(result); Assert.AreEqual<int>(0,result.Length); }
public void GetAttributeReturnsOnlyIfOneIsPresent() { bool inherit = false; MyAttribute attrib = new MyAttribute(); MockAttributeProvider provider = new MockAttributeProvider(new object[] { attrib }, inherit); MyAttribute result = ReflectionHelper.GetAttribute<MyAttribute>(provider, inherit); Assert.AreSame(attrib,result); }
public void GetAttributeReturnsNullIfMultipleFound() { bool inherit = false; MyAttribute attrib = new MyAttribute(); MockAttributeProvider provider = new MockAttributeProvider(new object[]{ attrib, attrib }, inherit); MyAttribute result = ReflectionHelper.GetAttribute<MyAttribute>(provider, inherit); Assert.IsNull(result); }
public void GetAttributesHandlesNull() { const bool inherit = false; MockAttributeProvider provider = new MockAttributeProvider(null, inherit); object[] result = ReflectionHelper.GetAttributes <object>(provider, inherit); Assert.IsNotNull(result); Assert.AreEqual(0, result.Length); }
public void GetAttributeReturnsOnlyIfOneIsPresent() { const bool inherit = false; MyAttribute attrib = new MyAttribute(); MockAttributeProvider provider = new MockAttributeProvider(new object[] { attrib }, inherit); MyAttribute result = ReflectionHelper.GetAttribute <MyAttribute>(provider, inherit); Assert.AreSame(attrib, result); }
public void GetAttributeReturnsNullIfMultipleFound() { const bool inherit = false; MyAttribute attrib = new MyAttribute(); MockAttributeProvider provider = new MockAttributeProvider(new object[] { attrib, attrib }, inherit); MyAttribute result = ReflectionHelper.GetAttribute <MyAttribute>(provider, inherit); Assert.IsNull(result); }
public void GetAttributesReturnsOnlyOne() { const bool inherit = false; MyAttribute attrib = new MyAttribute(); object[] attribs = { attrib }; MockAttributeProvider provider = new MockAttributeProvider(attribs, inherit); MyAttribute[] result = ReflectionHelper.GetAttributes <MyAttribute>(provider, inherit); Assert.AreEqual(attribs.Length, result.Length); }
public void GetAttributesReturnsNotEmpty() { bool inherit = false; MyAttribute attrib = new MyAttribute(); object[] attribs = new object[] { attrib, attrib }; MockAttributeProvider provider = new MockAttributeProvider(attribs, inherit); MyAttribute[] result = ReflectionHelper.GetAttributes <MyAttribute>(provider, inherit); Assert.AreEqual <int>(attribs.Length, result.Length); }
public void GetAttributesReturnsOnlyOne() { bool inherit = false; MyAttribute attrib = new MyAttribute(); object[] attribs = new object[] { attrib }; MockAttributeProvider provider = new MockAttributeProvider(attribs, inherit); MyAttribute[] result = ReflectionHelper.GetAttributes<MyAttribute>(provider, inherit); Assert.AreEqual<int>(attribs.Length, result.Length); }