本文整理汇总了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.");
}
示例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.");
}
示例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"
});
}
示例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"
});
}
示例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");
}
示例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);
}
示例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");
}
示例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`");
}