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);
                }
            }
        }
        private static void CheckWebDatabase(ITestContext context)
        {
            var web = context.Databases.Sql["web"];

            if (web == null)
            {
                return;
            }

            // create read item context to instantiate caches - they will be destroyed when it is disposed
            using (var items = web.Items.CreateContext())
            {
                // LinqToSql count how many home items in web db (https://github.com/Sitecore/Sitecore.Diagnostics.SqlDataProvider)
                var homeItemsCount = items.GetItems().Count(x => x.Name == "Home");
                if (homeItemsCount == 0)
                {
                    context.Error("The /sitecore/content/Home item is missing");
                }

                // lets validate workflows (custom lightweight data provider Sitecore.DiagnosticsToolset.Resources.Database.dll)
                var workflowsRoot = items.GetItem(ItemIDs.WorkflowRoot, new GetItemOptions {
                    LoadChildren = true, LoadDescendants = false
                });
                if (workflowsRoot == null)
                {
                    context.Error("The /sitecore/system/workflows item is missing");

                    return;
                }

                foreach (var workflow in workflowsRoot.Children)
                {
                    var initialStepId = workflow.Fields.Shared["Initial"];
                    if (string.IsNullOrEmpty(initialStepId))
                    {
                        context.Error("The {0} workflow does not have initial workflow step set up", workflow.ItemPath);
                    }
                }
            }
        }
        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);
            }
              }
        }
        private static void CheckWebDatabase(ITestContext context)
        {
            var web = context.Databases.Sql["web"];
              if (web == null)
              {
            return;
              }

              // create read item context to instantiate caches - they will be destroyed when it is disposed
              using (var items = web.Items.CreateContext())
              {
            // LinqToSql count how many home items in web db (https://github.com/Sitecore/Sitecore.Diagnostics.SqlDataProvider)
            var homeItemsCount = items.GetItems().Count(x => x.Name == "Home");
            if (homeItemsCount == 0)
            {
              context.Error("The /sitecore/content/Home item is missing");
            }

            // lets validate workflows (custom lightweight data provider Sitecore.DiagnosticsToolset.Resources.Database.dll)
            var workflowsRoot = items.GetItem(ItemIDs.WorkflowRoot, new GetItemOptions { LoadChildren = true, LoadDescendants = false });
            if (workflowsRoot == null)
            {
              context.Error("The /sitecore/system/workflows item is missing");

              return;
            }

            foreach (var workflow in workflowsRoot.Children)
            {
              var initialStepId = workflow.Fields.Shared["Initial"];
              if (string.IsNullOrEmpty(initialStepId))
              {
            context.Error("The {0} workflow does not have initial workflow step set up", workflow.ItemPath);
              }
            }
              }
        }