Пример #1
0
        public LinqPadAutomation(string linqpadPath, string sampleSet, string exportDirectory)
        {
            if (String.IsNullOrWhiteSpace(linqpadPath))
                throw new ArgumentException("linqpadPath is null or empty");

            if (String.IsNullOrWhiteSpace(sampleSet))
                throw new ArgumentException("sampleSet is null or empty");

            if (String.IsNullOrWhiteSpace(exportDirectory))
                throw new ArgumentException("exportDirectory is null or empty");

            _exportDirectory = Path.Combine(Environment.CurrentDirectory, exportDirectory);

            _baselineDirectory = Path.Combine(
                Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
                "baseline");

            if (!Directory.Exists(_baselineDirectory))
            {
                _baselineDirectory = null;
            }

            _process = Process.Start(linqpadPath);

            var desktop = AutomationElement.RootElement;
            _mainWindow = desktop.WaitForChild("LINQPad 4", TimeSpan.FromSeconds(10));

            var samplesTab = _mainWindow
                .FindInDepth(ControlType.Pane, 4)
                .FindChildByIndex(ControlType.Pane, 1)
                .FindChildByAutomationId("tcQueryTrees")
                .FindChildByName("Samples");
            samplesTab.SetFocus();

            _samplesTree = samplesTab
                .FindChildByAutomationId("sampleQueries")
                .FindChildByName(sampleSet);
            _samplesTree.Expand();
        }
Пример #2
0
 public AutomationElementCollection GetSamplesInGroup(AutomationElement group)
 {
     group.Expand();
     return group.FindAllChildren(ControlType.TreeItem);
 }