Ejemplo n.º 1
0
 private static void SetForAllInvolvedTypesAttributes(ServiceMatcher matcher, IList <AttributePack> forAllInvolvedTypes)
 {
     foreach (var attribute in forAllInvolvedTypes)
     {
         matcher.SetAttributeForAllInvolvedTypes(attribute.AttributeType, attribute.CtorParamsMapping,
                                                 attribute.PropsValuesMapping);
     }
 }
        public void All_Types_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.Class);

            matcher.SetAttributeForAllInvolvedTypes(attributeType, ctorParams, props);

            var servicePack = matcher.Pack();

            AssertOnAllInvolvedTypesHasAttribute(servicePack, attributeType, props);
        }