本文整理汇总了C#中Microsoft.DotNet.Tools.Test.Utilities.BuildCommand.Execute方法的典型用法代码示例。如果您正苦于以下问题:C# BuildCommand.Execute方法的具体用法?C# BuildCommand.Execute怎么用?C# BuildCommand.Execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.DotNet.Tools.Test.Utilities.BuildCommand
的用法示例。
在下文中一共展示了BuildCommand.Execute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestDotnetIncrementalBuild
public void TestDotnetIncrementalBuild()
{
// first build
var buildCommand = new BuildCommand(TestProject, output: OutputDirectory, framework: NetCoreAppTfm);
buildCommand.Execute().Should().Pass();
TestOutputExecutable(OutputDirectory, buildCommand.GetPortableOutputName(), s_expectedOutput);
var binariesOutputDirectory = GetCompilationOutputPath(OutputDirectory, false);
var latestWriteTimeFirstBuild = GetLastWriteTimeUtcOfDirectoryFiles(
binariesOutputDirectory);
// second build; should get skipped (incremental because no inputs changed)
buildCommand.Execute().Should().Pass();
TestOutputExecutable(OutputDirectory, buildCommand.GetPortableOutputName(), s_expectedOutput);
var latestWriteTimeUtcSecondBuild = GetLastWriteTimeUtcOfDirectoryFiles(
binariesOutputDirectory);
Assert.Equal(latestWriteTimeFirstBuild, latestWriteTimeUtcSecondBuild);
TouchSourceFileInDirectory(TestDirectory);
// third build; should get compiled because the source file got touched
buildCommand.Execute().Should().Pass();
TestOutputExecutable(OutputDirectory, buildCommand.GetPortableOutputName(), s_expectedOutput);
var latestWriteTimeUtcThirdBuild = GetLastWriteTimeUtcOfDirectoryFiles(
binariesOutputDirectory);
Assert.NotEqual(latestWriteTimeUtcSecondBuild, latestWriteTimeUtcThirdBuild);
}
示例2: Setup
private void Setup([CallerMemberName] string callingMethod = "")
{
var testInstance = TestAssetsManager.CreateTestInstance(Path.Combine("ProjectsWithTests", "MultipleFrameworkProject"), callingMethod);
_projectFilePath = Path.Combine(testInstance.TestRoot, "project.json");
var contexts = ProjectContext.CreateContextForEachFramework(
_projectFilePath,
null,
RuntimeEnvironmentRidExtensions.GetAllCandidateRuntimeIdentifiers());
// Restore the project again in the destination to resolve projects
// Since the lock file has project relative paths in it, those will be broken
// unless we re-restore
new RestoreCommand() { WorkingDirectory = testInstance.TestRoot }.Execute().Should().Pass();
_netCoreAppOutputPath = Path.Combine(testInstance.TestRoot, "bin", "Debug", "netcoreapp1.0");
var buildCommand = new BuildCommand(_projectFilePath);
var result = buildCommand.Execute($"-f netcoreapp1.0 -o {_netCoreAppOutputPath}");
result.Should().Pass();
if (RuntimeEnvironment.OperatingSystemPlatform == Platform.Windows)
{
var rid = RuntimeEnvironmentRidExtensions.GetAllCandidateRuntimeIdentifiers().First();
_net451OutputPath = Path.Combine(testInstance.TestRoot, "bin", "Debug", "net451", rid);
result = buildCommand.Execute($"-f net451 -r {rid} -o {_net451OutputPath}");
result.Should().Pass();
}
}
开发者ID:akrisiun,项目名称:dotnet-cli,代码行数:29,代码来源:GivenThatWeWantToUseDotnetTestE2EInDesignTimeForMultipleTFms.cs
示例3: TestDotnetBuild
public void TestDotnetBuild()
{
var buildCommand = new BuildCommand(TestProject, output: OutputDirectory, framework: DefaultFramework);
buildCommand.Execute().Should().Pass();
TestOutputExecutable(OutputDirectory, buildCommand.GetOutputExecutableName(), s_expectedOutput);
}
示例4: TestDotnetBuild
public void TestDotnetBuild()
{
var buildCommand = new BuildCommand(TestProject, output: OutputDirectory);
buildCommand.Execute().Should().Pass();
TestOutputExecutable(OutputDirectory, buildCommand.GetOutputExecutableName());
}
示例5: TestDotnetBuild
public void TestDotnetBuild()
{
var buildCommand = new BuildCommand(TestProject, output: OutputDirectory, framework: NetCoreAppTfm);
buildCommand.Execute().Should().Pass();
TestOutputExecutable(OutputDirectory, buildCommand.GetPortableOutputName(), s_expectedOutput);
}
示例6: It_skips_build_when_the_no_build_flag_is_passed
public void It_skips_build_when_the_no_build_flag_is_passed()
{
var buildCommand = new BuildCommand(_projectFilePath);
var result = buildCommand.Execute();
result.Should().Pass();
var testCommand = new DotnetTestCommand();
result = testCommand.Execute($"{_projectFilePath} -o {_defaultOutputPath} --no-build");
result.Should().Pass();
}
示例7: Setup
private void Setup(string project, ref string projectDir, ref string buildDir, ref string publishDir)
{
projectDir = Path.Combine(_testInstance.TestRoot, project);
buildDir = Path.Combine(projectDir, _buildRelativePath);
publishDir = Path.Combine(projectDir, "publish");
var buildCommand = new BuildCommand(projectDir, framework: Framework, runtime: _Runtime);
buildCommand.Execute().Should().Pass();
var publishCommand = new PublishCommand(projectDir, output: publishDir, framework: Framework, runtime: _Runtime);
publishCommand.Execute().Should().Pass();
}
示例8: Compilation_of_app_with_invalid_source_should_fail
public void Compilation_of_app_with_invalid_source_should_fail()
{
var testProject = Path.Combine(s_testProjectsRoot, "CompileFailApp", "project.json");
var buildCommand = new BuildCommand(testProject);
var oldDirectory = Directory.GetCurrentDirectory();
Directory.SetCurrentDirectory(Path.GetDirectoryName(testProject));
buildCommand.Execute().Should().Fail();
Directory.SetCurrentDirectory(oldDirectory);
}
示例9: Compilation_of_valid_app_should_succeed
public void Compilation_of_valid_app_should_succeed()
{
var testProject = Path.Combine(s_testProjectsRoot, "TestAppWithArgs", "project.json");
var buildCommand = new BuildCommand(testProject);
var oldDirectory = Directory.GetCurrentDirectory();
Directory.SetCurrentDirectory(Path.GetDirectoryName(testProject));
buildCommand.Execute().Should().Pass();
Directory.SetCurrentDirectory(oldDirectory);
}
示例10: Test_Build_Project_with_Resources_with_Space_in_Path_Should_Succeed
public void Test_Build_Project_with_Resources_with_Space_in_Path_Should_Succeed()
{
var spaceBufferDirectory = _root.CreateDirectory("space directory");
var testAppDir = spaceBufferDirectory.CreateDirectory("TestProjectWithResource");
CopyProjectToTempDir(Path.Combine(_testProjectsRoot, "TestProjectWithResource"), testAppDir);
var testProject = GetProjectPath(testAppDir);
var buildCommand = new BuildCommand(testProject);
buildCommand.Execute().Should().Pass();
}
示例11: BuildSingleProject
public void BuildSingleProject(TestInstance instance)
{
foreach (var iteration in Benchmark.Iterations)
{
var buildCommand = new BuildCommand(instance.TestRoot, buildProfile: false);
using (iteration.StartMeasurement())
{
buildCommand.Execute().Should().Pass();
}
TouchSource(instance.TestRoot);
}
}
示例12: TestDotnetBuildNativeCpp
public void TestDotnetBuildNativeCpp()
{
if(IsCentOS())
{
Console.WriteLine("Skipping native compilation tests on CentOS - https://github.com/dotnet/cli/issues/453");
return;
}
var buildCommand = new BuildCommand(TestProject, output: OutputDirectory, native: true, nativeCppMode: true);
buildCommand.Execute().Should().Pass();
var nativeOut = Path.Combine(OutputDirectory, "native");
TestOutputExecutable(nativeOut, buildCommand.GetOutputExecutableName());
}
示例13: GivenThatWeWantToUseDotnetTestE2EInDesignTime
public GivenThatWeWantToUseDotnetTestE2EInDesignTime()
{
var testInstance = TestAssetsManager.CreateTestInstance("ProjectWithTests").WithLockFiles();
_projectFilePath = Path.Combine(testInstance.TestRoot, "project.json");
var contexts = ProjectContext.CreateContextForEachFramework(
_projectFilePath,
null,
PlatformServices.Default.Runtime.GetAllCandidateRuntimeIdentifiers());
var runtime = contexts.FirstOrDefault(c => !string.IsNullOrEmpty(c.RuntimeIdentifier))?.RuntimeIdentifier;
_outputPath = Path.Combine(testInstance.TestRoot, "bin", "Debug", DefaultFramework, runtime);
var buildCommand = new BuildCommand(_projectFilePath);
var result = buildCommand.Execute();
result.Should().Pass();
}
示例14: MeasureDotNetBuild
public void MeasureDotNetBuild()
{
foreach (var iter in Benchmark.Iterations)
{
// Setup a new instance of the test project.
TestInstanceSetup();
// Setup the build command.
var buildCommand = new BuildCommand(TestProject, output: OutputDirectory, framework: DefaultFramework);
using (iter.StartMeasurement())
{
// Execute the build command.
buildCommand.Execute();
}
}
}
示例15: GivenThatWeWantToUseDotnetTestE2EInDesignTime
public GivenThatWeWantToUseDotnetTestE2EInDesignTime()
{
var testInstance = TestAssetsManager.CreateTestInstance(Path.Combine("ProjectsWithTests", "NetCoreAppOnlyProject"));
_projectFilePath = Path.Combine(testInstance.TestRoot, "project.json");
var contexts = ProjectContext.CreateContextForEachFramework(
_projectFilePath,
null,
RuntimeEnvironmentRidExtensions.GetAllCandidateRuntimeIdentifiers());
// Restore the project again in the destination to resolve projects
// Since the lock file has project relative paths in it, those will be broken
// unless we re-restore
new RestoreCommand() { WorkingDirectory = testInstance.TestRoot }.Execute().Should().Pass();
_outputPath = Path.Combine(testInstance.TestRoot, "bin", "Debug", "netcoreapp1.0");
var buildCommand = new BuildCommand(_projectFilePath);
var result = buildCommand.Execute();
result.Should().Pass();
}