本文整理汇总了C#中System.IO.DirectoryInfo.Sub方法的典型用法代码示例。如果您正苦于以下问题:C# DirectoryInfo.Sub方法的具体用法?C# DirectoryInfo.Sub怎么用?C# DirectoryInfo.Sub使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.IO.DirectoryInfo
的用法示例。
在下文中一共展示了DirectoryInfo.Sub方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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"
});
}
示例2: 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"
});
}
示例3: 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");
}
示例4: 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);
}
示例5: PackageReferenceWithResourcesTest
public void PackageReferenceWithResourcesTest()
{
var testInstance = TestAssetsManager.CreateTestInstance("ResourcesTests")
.WithLockFiles();
var projectRoot = Path.Combine(testInstance.TestRoot, "TestApp");
var cmd = new BuildCommand(projectRoot);
var result = cmd.Execute();
result.Should().Pass();
var outputDir = new DirectoryInfo(Path.Combine(projectRoot, "bin", "Debug", "netcoreapp1.0"));
outputDir.Should().HaveFile("TestLibraryWithResources.dll");
outputDir.Sub("fr").Should().HaveFile("TestLibraryWithResources.resources.dll");
var depsJson = JObject.Parse(File.ReadAllText(Path.Combine(outputDir.FullName, $"{Path.GetFileNameWithoutExtension(cmd.GetOutputExecutableName())}.deps.json")));
foreach (var library in new[] { Tuple.Create("Microsoft.Data.OData", "5.6.4"), Tuple.Create("TestLibraryWithResources", "1.0.0") })
{
var resources = depsJson["targets"][".NETCoreApp,Version=v1.0"][library.Item1 + "/" + library.Item2]["resources"];
resources.Should().NotBeNull();
foreach (var item in resources.Children<JProperty>())
{
var locale = item.Value["locale"];
locale.Should().NotBeNull();
item.Name.Should().EndWith($"{locale}/{library.Item1}.resources.dll");
}
}
}