Exemple #1
0
        /// <summary>
        /// creates a CoreRunToolchain which is using provided CoreRun to execute .NET Core apps
        /// </summary>
        /// <param name="coreRun">the path to CoreRun</param>
        /// /<param name="createCopy">should a copy of CoreRun be performed? True by default. <remarks>The toolchain replaces old dependencies in CoreRun folder with newer versions if used by the benchmarks.</remarks></param>
        /// <param name="targetFrameworkMoniker">TFM, netcoreapp2.1 is the default</param>
        /// <param name="customDotNetCliPath">path to dotnet cli, if not provided the one from PATH will be used</param>
        /// <param name="displayName">display name, CoreRun is the default value</param>
        /// <param name="restorePath">the directory to restore packages to</param>
        /// <param name="timeout">the timeout for building the benchmarks</param>
        public CoreRunToolchain(FileInfo coreRun, bool createCopy = true,
                                string targetFrameworkMoniker     = "netcoreapp2.1",
                                FileInfo customDotNetCliPath      = null, DirectoryInfo restorePath = null,
                                string displayName = "CoreRun",
                                TimeSpan?timeout   = null)
        {
            if (coreRun == null)
            {
                throw new ArgumentNullException(nameof(coreRun));
            }
            if (!coreRun.Exists)
            {
                throw new FileNotFoundException("Provided CoreRun path does not exist");
            }

            SourceCoreRun       = coreRun;
            CopyCoreRun         = createCopy ? GetShadowCopyPath(coreRun) : coreRun;
            CustomDotNetCliPath = customDotNetCliPath;
            RestorePath         = restorePath;

            Name      = displayName;
            Generator = new CoreRunGenerator(SourceCoreRun, CopyCoreRun, targetFrameworkMoniker, customDotNetCliPath?.FullName, restorePath?.FullName);
            Builder   = new CoreRunPublisher(CopyCoreRun, customDotNetCliPath, timeout);
            Executor  = new DotNetCliExecutor(customDotNetCliPath: CopyCoreRun.FullName); // instead of executing "dotnet $pathToDll" we do "CoreRun $pathToDll"
        }
Exemple #2
0
        public void Create_ShouldThrowException_WhenSolutionNameIsInvalid()
        {
            var commandBuilder = new DotNetCommandBuilder();
            var dotnetCli      = new DotNetCliExecutor(commandBuilder);

            var solution = new Solution(dotnetCli);

            var projectPath  = "test";
            var solutionName = "   ";

            Assert.Throws <ArgumentException>(
                () => solution.Create(projectPath, solutionName)
                );
        }
Exemple #3
0
        public void Create_ShouldCreateFolderAndSolutionFile()
        {
            var commandBuilder = new DotNetCommandBuilder();
            var dotnetCli      = new DotNetCliExecutor(commandBuilder);

            var solution = new Solution(dotnetCli);

            var projectPath  = "test";
            var solutionName = "SolutionName";

            solution.Create(projectPath, solutionName);

            Environment.CurrentDirectory.Should().Contain("test");
            File.Exists($"{solutionName}.sln");
        }
        public DotNetCliExecutorTest()
        {
            var commandBuilder = new DotNetCommandBuilder();

            _dotnetCli = new DotNetCliExecutor(commandBuilder);
        }