private void AddAbcAttribute(IMutableInfo customAttributeTarget, string value)
        {
            var ctor      = NormalizingMemberInfoFromExpressionUtility.GetConstructor(() => new AbcAttribute(""));
            var attribute = new CustomAttributeDeclaration(ctor, new object[] { value });

            customAttributeTarget.AddCustomAttribute(attribute);
        }
Exemplo n.º 2
0
        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"));
        }
Exemplo n.º 3
0
        private void SetupDefineCustomAttribute(ICustomAttributeTargetBuilder customAttributeTargetBuilderMock, IMutableInfo mutableInfo)
        {
            var declaration = CustomAttributeDeclarationObjectMother.Create();

            mutableInfo.AddCustomAttribute(declaration);
            customAttributeTargetBuilderMock.Expect(mock => mock.SetCustomAttribute(declaration));
        }
Exemplo n.º 4
0
        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();
        }
Exemplo n.º 5
0
 private void DefineCustomAttributes(ICustomAttributeTargetBuilder customAttributeTargetBuilder, IMutableInfo mutableInfo)
 {
     foreach (var declaration in mutableInfo.AddedCustomAttributes)
     {
         customAttributeTargetBuilder.SetCustomAttribute(declaration);
     }
 }