public void Setup()
        {
            this.callHandlerData =
                new LogCallHandlerData("logging")
                {
                    Order = 400,

                    LogBehavior = HandlerLogBehavior.BeforeAndAfter,
                    BeforeMessage = "before",
                    AfterMessage = "after",
                    EventId = 1000,
                    IncludeCallStack = true,
                    IncludeCallTime = false,
                    IncludeParameterValues = true,
                    Priority = 500,
                    Severity = TraceEventType.Warning,
                    Categories = 
                    { 
                        new LogCallHandlerCategoryEntry("cat1"), 
                        new LogCallHandlerCategoryEntry("cat2"), 
                        new LogCallHandlerCategoryEntry("cat3")
                    }
                };

            this.logWriter = new LogWriter(new LoggingConfiguration());
            Logger.SetLogWriter(this.logWriter, false);
        }
 public void Setup()
 {
     callHandlerData =
         new CustomCallHandlerData("custom", typeof(GlobalCountCallHandler))
         {
             Order = 100,
             Attributes = { { "callhandler", "bar" }, { "bar", "baz" } }
         };
 }
 public void Setup()
 {
     callHandlerData =
         new ExceptionCallHandlerData("exception")
         {
             Order = 400,
             ExceptionPolicyName = "policy"
         };
 }
 public void Setup()
 {
     callHandlerData =
         new ValidationCallHandlerData("validation")
             {
                 Order = 300,
                 SpecificationSource = SpecificationSource.Attributes,
                 RuleSet = "ruleset"
             };
 }
 public void Setup()
 {
     callHandlerData =
         new AuthorizationCallHandlerData("authorization")
             {
                 AuthorizationProvider = "provider",
                 OperationName = "operation",
                 Order = 200
             };
 }
        public static CallHandlerData SerializeAndDeserializeHandler(CallHandlerData handlerData)
        {
            PolicyData policy = new PolicyData("policy");
            policy.Handlers.Add(handlerData);

            PolicyInjectionSettings settings = new PolicyInjectionSettings();
            settings.Policies.Add(policy);

            Dictionary<string, ConfigurationSection> sections = new Dictionary<string, ConfigurationSection>();
            sections.Add(PolicyInjectionSettings.SectionName, settings);

            IConfigurationSource configurationSource =
                ConfigurationTestHelper.SaveSectionsInFileAndReturnConfigurationSource(sections);

            PolicyInjectionSettings deserializedSection =
                configurationSource.GetSection(PolicyInjectionSettings.SectionName) as PolicyInjectionSettings;
            Assert.IsNotNull(deserializedSection);

            PolicyData deserializedPolicy = deserializedSection.Policies.Get(0);
            Assert.IsNotNull(deserializedPolicy);
            return deserializedPolicy.Handlers.Get(0);
        }
 public void Setup()
 {
     callHandlerData =
         new ValidationCallHandlerData("validation")
             {
                 Order = 400,
                 SpecificationSource = SpecificationSource.Configuration,
                 RuleSet = "ruleset"
             };
 }
        public void Setup()
        {
            callHandlerData =
                new LogCallHandlerData("logging")
                {
                    Order = 400,

                    LogBehavior = HandlerLogBehavior.After,
                    BeforeMessage = "before",
                    AfterMessage = "after",
                    EventId = 1000,
                    IncludeCallStack = true,
                    IncludeCallTime = false,
                    IncludeParameterValues = true,
                    Priority = 500,
                    Severity = TraceEventType.Warning,
                    Categories = 
                    { 
                        new LogCallHandlerCategoryEntry("cat1"), 
                        new LogCallHandlerCategoryEntry("cat2"), 
                        new LogCallHandlerCategoryEntry("cat3")
                    }
                };
        }
 public void Setup()
 {
     callHandlerData =
         new PerformanceCounterCallHandlerData("perf counter")
             {
                 Order = 300,
                 CategoryName = "category",
                 InstanceName = "instance",
                 UseTotalCounter = true,
                 IncrementNumberOfCalls = false,
                 IncrementCallsPerSecond = true,
                 IncrementAverageCallDuration = false,
                 IncrementTotalExceptions = true,
                 IncrementExceptionsPerSecond = false
             };
 }