public OtherCtorAttributeImpl(OtherCtorAttribute a, ITypeAttributesCache owner) { _attribute = a ?? throw new ArgumentNullException(nameof(a)); Constructed = true; owner.Type.Should().Be(typeof(S5)); owner.GetAllCustomAttributes <IAttributeTypeSample>().Should().BeEmpty("In the constructor, no attribute are available."); }
void IAttributeContextBoundInitializer.Initialize(IActivityMonitor monitor, ITypeAttributesCache owner, MemberInfo m) { Initialized = true; owner.Type.Should().Be(typeof(S2)); m.Name.Should().Be("M"); }
public void Initialize(IActivityMonitor monitor, ITypeAttributesCache owner, MemberInfo m) { Initialized = true; owner.Type.Should().Be(typeof(S1)); m.Name.Should().Be("M"); }
void IAttributeContextBoundInitializer.Initialize(IActivityMonitor monitor, ITypeAttributesCache owner, MemberInfo m) { Initialized = true; owner.GetAllCustomAttributes <IAttributeTypeSample>().Should().HaveCount(2, "In the IAttributeContextBoundInitializer.Initialize, other attributes are available!"); }
public OneCtorAttributeImpl(ContextBoundAttributeTests thisTest, OneCtorAttribute a, ITypeAttributesCache owner, Type type, MethodInfo m) { _attribute = a ?? throw new ArgumentNullException(nameof(a)); Constructed = true; // We use this attribute in the S5 and S6 scenario. type.Should().Match(t => t == typeof(S4) || t == typeof(S5) || t == typeof(IServiceWithAttributeOnMember)); owner.Type.Should().Match(t => t == typeof(S4) || t == typeof(S5) || t == typeof(IServiceWithAttributeOnMember)); if (type == typeof(S4) || type == typeof(S5)) { m.Name.Should().Be("M"); } else { m.Name.Should().Be("OnAnInterface"); } }
public void Initialize(IActivityMonitor monitor, ITypeAttributesCache owner, MemberInfo m) { throw new System.NotImplementedException("This is never called since the delegated attribute OneAttributeImpl replaces this one."); }