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

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

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