public void GetAttribute_Inherit_Method_IndexSetButOfOufRange() { // Arrange var provider = typeof(ChildPoco).GetMethod(nameof(ChildPoco.MyMethodWithMultipleAttributes)); // Act CustomAttributeProviderExtensions.GetAttribute <SimpleAttribute>(provider, index: 99); }
public void GetAttribute_NoMatchingTypes_Property() { // Arrange var provider = typeof(ChildPoco).GetProperty(nameof(ChildPoco.MyStringWithMultipleAttributes)); // Act CustomAttributeProviderExtensions.GetAttribute <OtherAttribute>(provider); }
public void GetAttribute_Property() { // Arrange var provider = typeof(ChildPoco).GetProperty(nameof(ChildPoco.MyStringWithMultipleAttributes)); var expected = new ChildAttribute(); // Act var actual = CustomAttributeProviderExtensions.GetAttribute <SimpleAttribute>(provider); // Assert actual.ShouldHaveSameValueAs(expected); }
public void GetAttribute_Inherit_Method_IndexSet() { // Arrange var provider = typeof(ChildPoco).GetMethod(nameof(ChildPoco.MyMethodWithMultipleAttributes)); var expected = new ChildAttribute() { MyValue = 1 }; // Act var actual = CustomAttributeProviderExtensions.GetAttribute <SimpleAttribute>(provider, index: 1); // Assert actual.ShouldHaveSameValueAs(expected); }
public void GetAttribute_InstanceNull_Property() { // Act CustomAttributeProviderExtensions.GetAttribute <Attribute>(null); }