示例#1
0
        public bool RunTests(Project project, string filter, bool debug)
        {
            if (!VsxHelper.Build(project))
            {
                MessageBox.Show("Build failed.",
                                "SpecFlow",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
                return(true);
            }

            var consolePath = FindConsolePath(project);

            if (consolePath == null)
            {
                MessageBox.Show("Unable to find SpecRun.exe.",
                                "SpecFlow",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
                return(true);
            }

            var args = BuildCommandArgs(new ConsoleOptions
            {
                BaseFolder = VsxHelper.GetProjectFolder(project) + @"\bin\Debug",                                 //TODO
                Target     = VsxHelper.GetProjectAssemblyName(project) + ".dll",
                Filter     = filter
            }, debug);

            ExecuteTests(consolePath, args, debug);
            return(true);
        }
        protected override ProjectSettings LoadProjectSettings()
        {
            tracer.Trace("Discover project settings", "VsGeneratorServices");

            ProjectPlatformSettings projectPlatformSettings;
            var tergetLanguage = VsProjectScope.GetTargetLanguage(project);

            switch (tergetLanguage)
            {
            case ProgrammingLanguage.CSharp:
                projectPlatformSettings = new ProjectPlatformSettings
                {
                    Language        = GenerationTargetLanguage.CSharp,
                    LanguageVersion = new Version("3.0"),
                    Platform        = GenerationTargetPlatform.DotNet,
                    PlatformVersion = new Version("3.5"),
                };
                break;

            case ProgrammingLanguage.VB:
                projectPlatformSettings = new ProjectPlatformSettings
                {
                    Language        = GenerationTargetLanguage.VB,
                    LanguageVersion = new Version("9.0"),
                    Platform        = GenerationTargetPlatform.DotNet,
                    PlatformVersion = new Version("3.5"),
                };
                break;

            default:
                throw new NotSupportedException("target language not supported");
            }

            var configurationHolder = configurationReader.ReadConfiguration();

            return(new ProjectSettings
            {
                ProjectName = Path.GetFileNameWithoutExtension(project.FullName),
                AssemblyName = VsxHelper.GetProjectAssemblyName(project),
                ProjectFolder = VsxHelper.GetProjectFolder(project),
                DefaultNamespace = VsxHelper.GetProjectDefaultNamespace(project),
                ProjectPlatformSettings = projectPlatformSettings,
                ConfigurationHolder = configurationHolder
            });
        }