Exemplo n.º 1
0
        private void LoadTests(object sender, RoutedEventArgs e)
        {
            DTE dte;

            dte = (EnvDTE.DTE)Package.GetGlobalService(typeof(EnvDTE.DTE));
            var solutionPath = dte.Solution.FileName;

            if (string.IsNullOrWhiteSpace(solutionPath))
            {
                this.lblFilePath.Content    = "No project / solution open";
                this.lblFilePath.Background = new SolidColorBrush(Colors.Red);
                return;
            }
            // find the yaml file
            YamlFIlePath = Directory.GetFiles(Path.GetDirectoryName(solutionPath), "*.yaml").FirstOrDefault();

            if (string.IsNullOrEmpty(YamlFIlePath))
            {
                this.lblFilePath.Content    = "No file found";
                this.lblFilePath.Background = new SolidColorBrush(Colors.Red);
                return;
            }

            this.lblFilePath.Content    = Path.GetFileName(YamlFIlePath);
            this.lblFilePath.Background = new SolidColorBrush(Colors.Transparent);

            var yamlParser = new YamlFileParser(YamlFIlePath);

            foreach (var testModel in yamlParser.Parse())
            {
                Tests.Add(testModel);
            }
            yamlParser.Parse();
        }
Exemplo n.º 2
0
        private void LoadTests(object sender, RoutedEventArgs e)
        {

            DTE dte;
            dte = (EnvDTE.DTE)Package.GetGlobalService(typeof(EnvDTE.DTE));
            var solutionPath = dte.Solution.FileName;

            if (string.IsNullOrWhiteSpace(solutionPath))
            {
                this.lblFilePath.Content = "No project / solution open";
                this.lblFilePath.Background = new SolidColorBrush(Colors.Red);
                return;

            }
            // find the yaml file
            YamlFIlePath = Directory.GetFiles(Path.GetDirectoryName(solutionPath), "*.yaml").FirstOrDefault();

            if (string.IsNullOrEmpty(YamlFIlePath))
            {
                this.lblFilePath.Content = "No file found";
                this.lblFilePath.Background = new SolidColorBrush(Colors.Red);
                return;
            }
             
            this.lblFilePath.Content = Path.GetFileName(YamlFIlePath);
            this.lblFilePath.Background = new SolidColorBrush(Colors.Transparent);

            var yamlParser = new YamlFileParser(YamlFIlePath);

            foreach (var testModel in yamlParser.Parse())
            {
                Tests.Add(testModel);
            }
            yamlParser.Parse();
        }