本文整理汇总了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");
}
}
示例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);
}
}
}
示例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);
}
}