コード例 #1
0
 private static void SetForAllInvolvedTypeMembersAttributes(ServiceMatcher matcher, IList <AttributePack> forAllInvolvedTypeMembers)
 {
     foreach (var attribute in forAllInvolvedTypeMembers)
     {
         matcher.SetAttributeForAllInvolvedTypeMembers(attribute.AttributeType, attribute.CtorParamsMapping,
                                                       attribute.PropsValuesMapping);
     }
 }
        public void All_Types_Member_Involved_In_Specified_Interface_Must_Be_Attributed_With_Specified_Attribute()
        {
            var interfaceType = typeof(IComplexInterface);
            var attributeType = typeof(SomeAttribute);

            var ctorParams = new Dictionary <Type, object> {
                { typeof(string), "attributeName" }
            };
            var props = new Dictionary <string, object> {
                { "Index", 879 }
            };

            var matcher = new ServiceMatcher(interfaceType, TypeCategories.Interface);

            matcher.SetAttributeForAllInvolvedTypeMembers(attributeType, ctorParams, props);

            var servicePack = matcher.Pack();

            AssertOnAllInvolvedTypeMembersHasAttribute(servicePack, attributeType, props);
        }