当前位置: 首页>>代码示例>>C#>>正文


C# BuildCommand.Should方法代码示例

本文整理汇总了C#中Microsoft.DotNet.Tools.Test.Utilities.BuildCommand.Should方法的典型用法代码示例。如果您正苦于以下问题:C# BuildCommand.Should方法的具体用法?C# BuildCommand.Should怎么用?C# BuildCommand.Should使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.DotNet.Tools.Test.Utilities.BuildCommand的用法示例。


在下文中一共展示了BuildCommand.Should方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ErrorOccursWhenBuildingPortableProjectToSpecificOutputPathWithoutSpecifyingFramework

        public void ErrorOccursWhenBuildingPortableProjectToSpecificOutputPathWithoutSpecifyingFramework()
        {
            var testInstance = TestAssetsManager.CreateTestInstance("PortableTests")
                .WithLockFiles();

            var result = new BuildCommand(
                    projectPath: Path.Combine(testInstance.TestRoot, "PortableApp"),
                    output: Path.Combine(testInstance.TestRoot, "out"))
                .ExecuteWithCapturedOutput();

            result.Should().Fail();
            result.Should().HaveStdErrContaining("When the '--output' option is provided, the '--framework' option must also be provided.");
        }
开发者ID:krytarowski,项目名称:cli,代码行数:13,代码来源:BuildInvalidArgumentsTests.cs

示例2: ErrorOccursWhenBuildingPortableProjectAndSpecifyingFrameworkThatProjectDoesNotSupport

        public void ErrorOccursWhenBuildingPortableProjectAndSpecifyingFrameworkThatProjectDoesNotSupport()
        {
            var testInstance = TestAssetsManager.CreateTestInstance("PortableTests")
                .WithLockFiles();

            var result = new BuildCommand(
                    projectPath: Path.Combine(testInstance.TestRoot, "PortableApp"),
                    output: Path.Combine(testInstance.TestRoot, "out"),
                    framework: "sl40")
                .ExecuteWithCapturedOutput();

            result.Should().Fail();
            result.Should().HaveStdErrContaining("Project does not support framework: Silverlight,Version=v4.0.");
        }
开发者ID:krytarowski,项目名称:cli,代码行数:14,代码来源:BuildInvalidArgumentsTests.cs

示例3: BuildingAPortableProjectProducesDepsFile

        public void BuildingAPortableProjectProducesDepsFile()
        {
            var testInstance = TestAssetsManager.CreateTestInstance("BuildTestPortableProject")
                .WithLockFiles();

            var result = new BuildCommand(
                projectPath: testInstance.TestRoot,
                forcePortable: true)
                .ExecuteWithCapturedOutput();

            result.Should().Pass();

            var outputBase = new DirectoryInfo(Path.Combine(testInstance.TestRoot, "bin", "Debug"));

            var netstandardappOutput = outputBase.Sub("netstandardapp1.5");

            netstandardappOutput.Should()
                .Exist().And
                .HaveFiles(new[]
                {
                    "BuildTestPortableProject.deps",
                    "BuildTestPortableProject.deps.json",
                    "BuildTestPortableProject.dll",
                    "BuildTestPortableProject.pdb"
                });
        }
开发者ID:ericstj,项目名称:cli,代码行数:26,代码来源:BuildPortableTests.cs

示例4: BuildAndTest

        private static void BuildAndTest(string testRoot)
        {
            string appName = Path.GetFileName(testRoot);


            var result = new BuildCommand(
                projectPath: testRoot)
                .ExecuteWithCapturedOutput();

            result.Should().Pass();

            var outputBase = new DirectoryInfo(Path.Combine(testRoot, "bin", "Debug"));

            var netcoreAppOutput = outputBase.Sub("netcoreapp1.0");

            netcoreAppOutput.Should()
                .Exist().And
                .OnlyHaveFiles(new[]
                {
                    $"{appName}.deps.json",
                    $"{appName}.dll",
                    $"{appName}.pdb",
                    $"{appName}.runtimeconfig.json",
                    $"{appName}.runtimeconfig.dev.json"
                });
        }
开发者ID:akrisiun,项目名称:dotnet-cli,代码行数:26,代码来源:DotnetBuildTest.cs

示例5: Build

        private DirectoryInfo Build(TestInstance testInstance)
        {
            var result = new BuildCommand(
                projectPath: Path.Combine(testInstance.TestRoot, "PortableApp"))
                .ExecuteWithCapturedOutput();

            result.Should().Pass();

            var outputBase = new DirectoryInfo(Path.Combine(testInstance.TestRoot, "PortableApp", "bin", "Debug"));

            return outputBase.Sub("netstandard1.5");
        }
开发者ID:krytarowski,项目名称:cli,代码行数:12,代码来源:BuildPortableTests.cs

示例6: Build

        public DirectoryInfo Build(TestInstance testInstance)
        {
            var projectPath = Path.Combine(testInstance.TestRoot, "StandaloneApp");

            var result = new BuildCommand(
                projectPath: projectPath)
                .ExecuteWithCapturedOutput();

            var contexts = ProjectContext.CreateContextForEachFramework(
                projectPath,
                null,
                PlatformServices.Default.Runtime.GetAllCandidateRuntimeIdentifiers());

            var runtime = contexts.FirstOrDefault(c => !string.IsNullOrEmpty(c.RuntimeIdentifier))?.RuntimeIdentifier;

            result.Should().Pass();

            var outputBase = new DirectoryInfo(
                Path.Combine(testInstance.TestRoot, "StandaloneApp", "bin", "Debug", "netstandardapp1.5"));

            return outputBase.Sub(runtime);
        }
开发者ID:krwq,项目名称:cli,代码行数:22,代码来源:BuildStandAloneTests.cs

示例7: Build

        private static string Build(string testRoot)
        {
            string appName = Path.GetFileName(testRoot);

            var result = new BuildCommand(
                projectPath: testRoot)
                .ExecuteWithCapturedOutput();

            result.Should().Pass();

            // the correct build assembly is next to its deps.json file 
            var depsJsonFile = Directory.EnumerateFiles(testRoot, appName + FileNameSuffixes.DepsJson, SearchOption.AllDirectories).First();
            return Path.Combine(Path.GetDirectoryName(depsJsonFile), appName + ".dll");
        }
开发者ID:akrisiun,项目名称:dotnet-cli,代码行数:14,代码来源:DotnetTest.cs

示例8: StandaloneApp_WithoutCoreClrDll_Fails

        private void StandaloneApp_WithoutCoreClrDll_Fails()
        {
            // Convert a Portable App to Standalone to simulate the customer scenario
            var testInstance = TestAssetsManager.CreateTestInstance("DependencyChangeTest")
                                .WithLockFiles();

            // Convert the portable test project to standalone by removing "type": "platform" and adding rids
            var originalTestProject = Path.Combine(testInstance.TestRoot, "PortableApp_Standalone", "project.json");
            var modifiedTestProject = Path.Combine(testInstance.TestRoot, "PortableApp_Standalone", "project.json.modified");

            // Simulate a user editting the project.json
            File.Delete(originalTestProject);
            File.Copy(modifiedTestProject, originalTestProject);

            var buildResult = new BuildCommand(originalTestProject, framework: DefaultFramework)
                .ExecuteWithCapturedOutput();

            buildResult.Should().Fail();

            buildResult.StdErr.Should().Contain("Can not find runtime target for framework '.NETCoreApp,Version=v1.0' compatible with one of the target runtimes");
            buildResult.StdErr.Should().Contain("The project has not been restored or restore failed - run `dotnet restore`");
        }
开发者ID:akrisiun,项目名称:dotnet-cli,代码行数:22,代码来源:BuildOutputTests.cs


注:本文中的Microsoft.DotNet.Tools.Test.Utilities.BuildCommand.Should方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。