コード例 #1
0
        public void SetUp()
        {
            manager = new ExceptionManagerImpl(new Dictionary <string, ExceptionPolicyImpl>());
            ReflectionInstrumentationAttacher attacher
                = new ReflectionInstrumentationAttacher(
                      ((IInstrumentationEventProvider)manager).GetInstrumentationEventProvider(),
                      typeof(DefaultExceptionHandlingEventLogger),
                      new object[] { true, true, true, "ApplicationInstanceName" });

            attacher.BindInstrumentation();
        }
        public void SetUp()
        {
            IExceptionHandler[]  handlers    = new IExceptionHandler[] { new MockThrowingExceptionHandler() };
            ExceptionPolicyEntry policyEntry = new ExceptionPolicyEntry(PostHandlingAction.None, handlers);
            Dictionary <Type, ExceptionPolicyEntry> policyEntries = new Dictionary <Type, ExceptionPolicyEntry>();

            policyEntries.Add(typeof(ArgumentException), policyEntry);

            exceptionPolicy = new ExceptionPolicyImpl(policyName, policyEntries);

            ReflectionInstrumentationAttacher attacher
                = new ReflectionInstrumentationAttacher(
                      exceptionPolicy.GetInstrumentationEventProvider(),
                      typeof(ExceptionHandlingInstrumentationListener),
                      new object[] { policyName, true, true, true });

            attacher.BindInstrumentation();
        }
        public void SetUp()
        {
            IExceptionHandler[]  handlers    = new IExceptionHandler[] { new MockThrowingExceptionHandler() };
            ExceptionPolicyEntry policyEntry = new ExceptionPolicyEntry(PostHandlingAction.None, handlers);
            Dictionary <Type, ExceptionPolicyEntry> policyEntries = new Dictionary <Type, ExceptionPolicyEntry>();

            policyEntries.Add(typeof(ArgumentException), policyEntry);
            exceptionPolicy = new ExceptionPolicyImpl(policyName, policyEntries);
            ReflectionInstrumentationAttacher attacher
                = new ReflectionInstrumentationAttacher(
                      exceptionPolicy.GetInstrumentationEventProvider(),
                      typeof(ExceptionHandlingInstrumentationListener),
                      new object[] { policyName, true, true, true, "ApplicationInstanceName" });

            attacher.BindInstrumentation();
            nameFormatter                  = new FixedPrefixNameFormatter("Prefix - ");
            listener                       = new ExceptionHandlingInstrumentationListener(instanceName, true, true, true, nameFormatter);
            formattedInstanceName          = nameFormatter.CreateName(instanceName);
            totalExceptionHandlersExecuted = new EnterpriseLibraryPerformanceCounter(counterCategoryName, TotalExceptionHandlersExecuted, formattedInstanceName);
            totalExceptionsHandled         = new EnterpriseLibraryPerformanceCounter(counterCategoryName, TotalExceptionsHandled, formattedInstanceName);
        }