本文整理汇总了C#中Microsoft.DotNet.Tools.Test.Utilities.BuildCommand类的典型用法代码示例。如果您正苦于以下问题:C# BuildCommand类的具体用法?C# BuildCommand怎么用?C# BuildCommand使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BuildCommand类属于Microsoft.DotNet.Tools.Test.Utilities命名空间,在下文中一共展示了BuildCommand类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: 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
示例2: XmlDocumentationFileIsGenerated
public void XmlDocumentationFileIsGenerated()
{
// create unique directories in the 'temp' folder
var root = Temp.CreateDirectory();
var testLibDir = root.CreateDirectory("TestLibrary");
// copy projects to the temp dir and restore them
CopyProjectToTempDir(Path.Combine(_testProjectsRoot, "TestLibrary"), testLibDir);
RunRestore(testLibDir.Path);
// run compile
var outputDir = Path.Combine(testLibDir.Path, "bin");
var testProject = GetProjectPath(testLibDir);
var buildCommand = new BuildCommand(testProject, output: outputDir);
var result = buildCommand.ExecuteWithCapturedOutput();
result.Should().Pass();
// Should have triggered some compiler warnings about missing XML doc comments
Assert.True(result.StdErr.Contains("warning CS1591"));
// verify the output xml file
var outputXml = Path.Combine(outputDir, "TestLibrary.xml");
Assert.True(File.Exists(outputXml));
Assert.Contains("Gets the message from the helper", File.ReadAllText(outputXml));
}
开发者ID:alexanderkyte,项目名称:cli,代码行数:25,代码来源:CompilerTests.cs
示例3: 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
示例4: 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
示例5: XmlDocumentationFileIsGenerated
public void XmlDocumentationFileIsGenerated()
{
// create unique directories in the 'temp' folder
var root = Temp.CreateDirectory();
root.CopyFile(Path.Combine(_testProjectsRoot, "global.json"));
var testLibDir = root.CreateDirectory("TestLibrary");
// copy projects to the temp dir and restore them
CopyProjectToTempDir(Path.Combine(_testProjectsRoot, "TestLibrary"), testLibDir);
RunRestore(testLibDir.Path);
// run compile
var outputDir = Path.Combine(testLibDir.Path, "bin");
var testProject = GetProjectPath(testLibDir);
var buildCommand = new BuildCommand(testProject, output: outputDir);
var result = buildCommand.ExecuteWithCapturedOutput();
result.Should().Pass();
// verify the output xml file
var outputXml = Path.Combine(outputDir, "Debug", "dnxcore50", "TestLibrary.xml");
Console.WriteLine("OUTPUT XML PATH: " + outputXml);
Assert.True(File.Exists(outputXml));
Assert.Contains("Gets the message from the helper", File.ReadAllText(outputXml));
}
开发者ID:robmen,项目名称:dotnetcli,代码行数:25,代码来源:CompilerTests.cs
示例6: 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);
}
开发者ID:krwq,项目名称:cli,代码行数:29,代码来源:EndToEndTest.cs
示例7: It_resolves_desktop_apps_when_configuration_is_Debug
public void It_resolves_desktop_apps_when_configuration_is_Debug()
{
var configuration = "Debug";
var testAssetManager = new TestAssetsManager(Path.Combine(RepoRoot, "TestAssets", "DesktopTestProjects"));
var testInstance = testAssetManager.CreateTestInstance("AppWithDirectDependencyDesktopAndPortable")
.WithLockFiles();
var buildCommand = new BuildCommand(
Path.Combine(testInstance.TestRoot, "project.json"),
configuration: configuration)
.ExecuteWithCapturedOutput()
.Should()
.Pass();
var context = ProjectContext.Create(testInstance.TestRoot, s_desktopTestFramework);
var factory = new ProjectDependenciesCommandFactory(
s_desktopTestFramework,
configuration,
null,
null,
testInstance.TestRoot);
var command = factory.Create("dotnet-desktop-and-portable", null);
command.CommandName.Should().Contain(Path.Combine(testInstance.TestRoot, "bin", configuration));
Path.GetFileName(command.CommandName).Should().Be("dotnet-desktop-and-portable.exe");
}
开发者ID:akrisiun,项目名称:dotnet-cli,代码行数:29,代码来源:GivenAProjectDependenciesCommandFactory.cs
示例8: TestDotnetBuild
public void TestDotnetBuild()
{
var buildCommand = new BuildCommand(TestProject, output: OutputDirectory, framework: NetCoreAppTfm);
buildCommand.Execute().Should().Pass();
TestOutputExecutable(OutputDirectory, buildCommand.GetPortableOutputName(), s_expectedOutput);
}
开发者ID:krwq,项目名称:cli,代码行数:8,代码来源:EndToEndTest.cs
示例9: TestDotnetBuild
public void TestDotnetBuild()
{
var buildCommand = new BuildCommand(TestProject, output: OutputDirectory);
buildCommand.Execute().Should().Pass();
TestOutputExecutable(OutputDirectory, buildCommand.GetOutputExecutableName());
}
开发者ID:yonglehou,项目名称:cli-1,代码行数:8,代码来源:EndToEndTest.cs
示例10: TestDotnetBuild
public void TestDotnetBuild()
{
var buildCommand = new BuildCommand(TestProject, output: OutputDirectory, framework: DefaultFramework);
buildCommand.Execute().Should().Pass();
TestOutputExecutable(OutputDirectory, buildCommand.GetOutputExecutableName(), s_expectedOutput);
}
开发者ID:cdmihai,项目名称:cli,代码行数:8,代码来源:EndToEndTest.cs
示例11: 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();
}
开发者ID:krytarowski,项目名称:cli,代码行数:10,代码来源:GivenThatWeWantToRunTestsInTheConsole.cs
示例12: 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);
}
}
开发者ID:akrisiun,项目名称:dotnet-cli,代码行数:12,代码来源:BuildPerformanceTest.cs
示例13: 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);
}
开发者ID:krytarowski,项目名称:cli,代码行数:12,代码来源:GivenThatIWantToCompileFSharpPrograms.cs
示例14: 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();
}
开发者ID:akrisiun,项目名称:dotnet-cli,代码行数:12,代码来源:TestSetupFixture.cs
示例15: 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();
}
开发者ID:noahfalk,项目名称:cli,代码行数:12,代码来源:Microsoft.DotNet.Tools.Resgen.Tests.cs
示例16: 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);
}
开发者ID:krytarowski,项目名称:cli,代码行数:12,代码来源:GivenThatIWantToCompileFSharpPrograms.cs
示例17: 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
示例18: 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
示例19: 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
示例20: LibraryWithAnalyzer
public void LibraryWithAnalyzer()
{
var root = Temp.CreateDirectory();
var testLibDir = root.CreateDirectory("TestLibraryWithAnalyzer");
CopyProjectToTempDir(Path.Combine(_testProjectsRoot, "TestLibraryWithAnalyzer"), testLibDir);
// run compile
var outputDir = Path.Combine(testLibDir.Path, "bin");
var testProject = GetProjectPath(testLibDir);
var buildCmd = new BuildCommand(testProject, output: outputDir);
var result = buildCmd.ExecuteWithCapturedOutput();
result.Should().Pass();
Assert.Contains("CA1018", result.StdOut);
}
开发者ID:marono,项目名称:cli,代码行数:15,代码来源:CompilerTests.cs
注:本文中的Microsoft.DotNet.Tools.Test.Utilities.BuildCommand类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论