private void AddAbcAttribute(IMutableInfo customAttributeTarget, string value) { var ctor = NormalizingMemberInfoFromExpressionUtility.GetConstructor(() => new AbcAttribute("")); var attribute = new CustomAttributeDeclaration(ctor, new object[] { value }); customAttributeTarget.AddCustomAttribute(attribute); }
private void AddCustomAttributes(IMutableInfo mutableInfo) { mutableInfo.AddCustomAttribute(CreateSingleAttribute()); Assert.That( () => mutableInfo.AddCustomAttribute(CreateSingleAttribute()), Throws.InvalidOperationException.With.Message.EqualTo( "Attribute of type 'SingleAttribute' (with AllowMultiple = false) is already present.")); mutableInfo.AddCustomAttribute(CreateMultipleAttribute("abc")); mutableInfo.AddCustomAttribute(CreateMultipleAttribute("def")); }
private void SetupDefineCustomAttribute(ICustomAttributeTargetBuilder customAttributeTargetBuilderMock, IMutableInfo mutableInfo) { var declaration = CustomAttributeDeclarationObjectMother.Create(); mutableInfo.AddCustomAttribute(declaration); customAttributeTargetBuilderMock.Expect(mock => mock.SetCustomAttribute(declaration)); }
private void SetupDefineCustomAttribute <T> (Mock <T> customAttributeTargetBuilderMock, IMutableInfo mutableInfo) where T : class, ICustomAttributeTargetBuilder { var declaration = CustomAttributeDeclarationObjectMother.Create(); mutableInfo.AddCustomAttribute(declaration); customAttributeTargetBuilderMock.Setup(mock => mock.SetCustomAttribute(declaration)).Verifiable(); }
private void DefineCustomAttributes(ICustomAttributeTargetBuilder customAttributeTargetBuilder, IMutableInfo mutableInfo) { foreach (var declaration in mutableInfo.AddedCustomAttributes) { customAttributeTargetBuilder.SetCustomAttribute(declaration); } }