Exemplo n.º 1
0
        public void CreatesHandlerProperlyFromAttributes()
        {
            MethodInfo method = typeof(LoggingTarget).GetMethod("DoSomethingElse");

            Assert.IsNotNull(method);

            object[] attributes = method.GetCustomAttributes(typeof(LogCallHandlerAttribute), false);

            Assert.AreEqual(1, attributes.Length);

            LogCallHandlerAttribute att = attributes[0] as LogCallHandlerAttribute;

            IUnityContainer container   = new UnityContainer().AddNewExtension <Interception>();
            ICallHandler    callHandler = att.CreateHandler(container);

            Assert.IsNotNull(callHandler);
            Assert.AreEqual(9, callHandler.Order);
        }
Exemplo n.º 2
0
 private LogCallHandler GetHandlerFromAttribute(LogCallHandlerAttribute attribute)
 {
     return((LogCallHandler)attribute.CreateHandler());
 }
Exemplo n.º 3
0
 LogCallHandler GetHandlerFromAttribute(LogCallHandlerAttribute attribute)
 {
     return((LogCallHandler)attribute.CreateHandler(this.container));
 }