當前位置: 首頁>>代碼示例>>C#>>正文


C# DirectoryInfo.Sub方法代碼示例

本文整理匯總了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"
                });
        }
開發者ID:ericstj,項目名稱:cli,代碼行數:26,代碼來源:BuildPortableTests.cs

示例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"
                });
        }
開發者ID:akrisiun,項目名稱:dotnet-cli,代碼行數:26,代碼來源:DotnetBuildTest.cs

示例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");
        }
開發者ID:krytarowski,項目名稱:cli,代碼行數:12,代碼來源:BuildPortableTests.cs

示例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);
        }
開發者ID:krwq,項目名稱:cli,代碼行數:22,代碼來源:BuildStandAloneTests.cs

示例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");
                }
            }
        }
開發者ID:akrisiun,項目名稱:dotnet-cli,代碼行數:33,代碼來源:BuildOutputTests.cs


注:本文中的System.IO.DirectoryInfo.Sub方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。