当前位置: 首页>>代码示例>>C#>>正文


C# ITestContext.Warning方法代码示例

本文整理汇总了C#中ITestContext.Warning方法的典型用法代码示例。如果您正苦于以下问题:C# ITestContext.Warning方法的具体用法?C# ITestContext.Warning怎么用?C# ITestContext.Warning使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ITestContext的用法示例。


在下文中一共展示了ITestContext.Warning方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CheckIIS

 private void CheckIIS(ITestContext context)
 {
     var currentSite = context.WebServer.CurrentSite;
       var applicationPool = currentSite.ApplicationPool;
       var managedPipelineMode = applicationPool.ManagedPipelineMode;
       if (managedPipelineMode == PipelineMode.Classic)
       {
     context.Warning("The application pool is configured to be run with classic mode which can be a administration mistake");
       }
 }
开发者ID:Sitecore,项目名称:Sitecore-Diagnostics-Toolset,代码行数:10,代码来源:SampleTest.cs

示例2: CheckConfiguration

        private static void CheckConfiguration(ITestContext context)
        {
            // SitecoreInfo contains configuration, version and defaults
              var sitecoreInfo = context.SitecoreInfo;

              // showconfig.xml combined with web.config
              var configuration = sitecoreInfo.Configuration;
              if (configuration.SelectSingleElement("/configuration/sitecore") == null)
              {
            context.Error("The configuration is broken - missing <sitecore>...</sitecore> element");

            return;
              }

              var pipeline = sitecoreInfo.GetPipeline("httpRequestBegin");
              if (pipeline == null)
              {
            context.Error("The httpRequestBegin pipeline is not registered");

            return;
              }

              // check specific processor in httpRequestBegin pipeline
              var executeRequestType = TypeRef.Parse("Sitecore.Pipelines.HttpRequest.ExecuteRequest, Sitecore.Kernel");
              var executeRequest = pipeline.Processors.FirstOrDefault(x => x.Type == executeRequestType);
              if (executeRequest == null)
              {
            context.Warning("The {0} processor is missing which potentially can be configuration error", executeRequestType);
              }

              // download defaults for the given Sitecore version from cloud
              var defaults = sitecoreInfo.SitecoreDefaults;

              // check all default processors
              var defaultPipeline = defaults.GetPipeline("httpRequestBegin");
              Assert.IsNotNull(defaultPipeline, "The default httpRequestBegin pipeline cannot be null");

              foreach (var defaultProcessor in defaultPipeline.Processors)
              {
            Assert.IsNotNull(defaultProcessor, "The default processor in httpRequestBegin pipeline cannot be null");

            if (defaultProcessor.Type == executeRequestType)
            {
              // we already checked that manually
              continue;
            }

            var actualProcessor = pipeline.Processors.FirstOrDefault(x => x.Type == defaultProcessor.Type);
            if (actualProcessor == null)
            {
              context.Warning("The {0} processor is missing which potentially can be configuration error", defaultProcessor.Type);
            }
              }
        }
开发者ID:Sitecore,项目名称:Sitecore-Diagnostics-Toolset,代码行数:54,代码来源:SampleTest.cs

示例3: CheckLogs

        private static void CheckLogs(ITestContext context)
        {
            // only last 200MB of logs can be parsed
              var logs = context.Logs.GetSitecoreLogEntries(LogLevel.Error);

              foreach (var error in logs)
              {
            context.Warning("Potential error in the log file: \r\n{0}", error.Message);
              }
        }
开发者ID:Sitecore,项目名称:Sitecore-Diagnostics-Toolset,代码行数:10,代码来源:SampleTest.cs


注:本文中的ITestContext.Warning方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。