当前位置: 首页>>代码示例>>C#>>正文


C# DirectoryInfo.Should方法代码示例

本文整理汇总了C#中System.IO.DirectoryInfo.Should方法的典型用法代码示例。如果您正苦于以下问题:C# DirectoryInfo.Should方法的具体用法?C# DirectoryInfo.Should怎么用?C# DirectoryInfo.Should使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.IO.DirectoryInfo的用法示例。


在下文中一共展示了DirectoryInfo.Should方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OutputsPackagesFlatIntoOutputDirWhenOutputParameterIsPassed

        public void OutputsPackagesFlatIntoOutputDirWhenOutputParameterIsPassed()
        {
            var root = Temp.CreateDirectory();

            var testLibDir = root.CreateDirectory("TestLibrary");
            var sourceTestLibDir = Path.Combine(_testProjectsRoot, "TestLibraryWithConfiguration");

            CopyProjectToTempDir(sourceTestLibDir, testLibDir);

            var outputDir = new DirectoryInfo(Path.Combine(testLibDir.Path, "bin2"));
            var testProject = GetProjectPath(testLibDir);
            var buildCommand = new PackCommand(testProject, output: outputDir.FullName);
            var result = buildCommand.Execute();
            result.Should().Pass();

            outputDir.Should().Exist();
            outputDir.Should().HaveFiles(new[] { "TestLibrary.1.0.0.nupkg", "TestLibrary.1.0.0.symbols.nupkg" });
        }
开发者ID:ericstj,项目名称:cli,代码行数:18,代码来源:PackTests.cs

示例2: RefsPublishTest

        public void RefsPublishTest()
        {
            TestInstance instance = TestAssetsManager.CreateTestInstance("TestAppCompilationContext")
                                                     .WithLockFiles()
                                                     .WithBuildArtifacts();

            var testProject = _getProjectJson(instance.TestRoot, "TestApp");
            var publishCommand = new PublishCommand(testProject);
            publishCommand.Execute().Should().Pass();

            publishCommand.GetOutputDirectory().Should().HaveFile("TestApp.dll");
            publishCommand.GetOutputDirectory().Should().HaveFile("TestLibrary.dll");

            var refsDirectory = new DirectoryInfo(Path.Combine(publishCommand.GetOutputDirectory().FullName, "refs"));
            // Should have compilation time assemblies
            refsDirectory.Should().HaveFile("System.IO.dll");
            // Libraries in which lib==ref should be deduped
            refsDirectory.Should().NotHaveFile("TestLibrary.dll");
        }
开发者ID:akrisiun,项目名称:dotnet-cli,代码行数:19,代码来源:PublishTests.cs

示例3: RefsPublishTest

        public void RefsPublishTest()
        {
            // create unique directories in the 'temp' folder
            var root = Temp.CreateDirectory();

            var testAppDir = root.CreateDirectory("TestAppCompilationContext");
            var testLibDir = root.CreateDirectory("TestLibrary");

            // copy projects to the temp dir
            CopyProjectToTempDir(Path.Combine(_testProjectsRoot, "TestAppCompilationContext"), testAppDir);
            CopyProjectToTempDir(Path.Combine(_testProjectsRoot, "TestLibrary"), testLibDir);

            var testProject = GetProjectPath(testAppDir);
            var publishCommand = new PublishCommand(testProject);
            publishCommand.Execute().Should().Pass();

            publishCommand.GetOutputDirectory().Should().HaveFile("TestAppCompilationContext.dll");
            publishCommand.GetOutputDirectory().Should().HaveFile("TestLibrary.dll");

            var refsDirectory = new DirectoryInfo(Path.Combine(publishCommand.GetOutputDirectory().FullName, "refs"));
            // Should have compilation time assemblies
            refsDirectory.Should().HaveFile("System.IO.dll");
            // Libraries in which lib==ref should be deduped
            refsDirectory.Should().NotHaveFile("TestLibrary.dll");
        }
开发者ID:tijoytom,项目名称:cli,代码行数:25,代码来源:Microsoft.DotNet.Tools.Publish.Tests.cs

示例4: RefsPublishTest

        public void RefsPublishTest()
        {
            TestInstance instance = TestAssetsManager.CreateTestInstance("PortableTests")
                                                     .WithLockFiles();

            var publishCommand = new PublishCommand(Path.Combine(instance.TestRoot, "PortableAppCompilationContext"));
            publishCommand.Execute().Should().Pass();

            publishCommand.GetOutputDirectory(true).Should().HaveFile("PortableAppCompilationContext.dll");

            var refsDirectory = new DirectoryInfo(Path.Combine(publishCommand.GetOutputDirectory(true).FullName, "refs"));
            // Should have compilation time assemblies
            refsDirectory.Should().HaveFile("System.IO.dll");
            // Libraries in which lib==ref should be deduped
            refsDirectory.Should().NotHaveFile("PortableAppCompilationContext.dll");
        }
开发者ID:krwq,项目名称:cli,代码行数:16,代码来源:PublishPortableTests.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

示例6: HasServiceableFlagWhenArgumentPassed

        public void HasServiceableFlagWhenArgumentPassed()
        {
            var root = Temp.CreateDirectory();

            var testLibDir = root.CreateDirectory("TestLibrary");
            var sourceTestLibDir = Path.Combine(_testProjectsRoot, "TestLibraryWithConfiguration");

            CopyProjectToTempDir(sourceTestLibDir, testLibDir);

            var testProject = GetProjectPath(testLibDir);
            var packCommand = new PackCommand(testProject, configuration: "Debug", serviceable: true);
            var result = packCommand.Execute();
            result.Should().Pass();

            var outputDir = new DirectoryInfo(Path.Combine(testLibDir.Path, "bin", "Debug"));
            outputDir.Should().Exist();
            outputDir.Should().HaveFiles(new[] { "TestLibrary.1.0.0.nupkg", "TestLibrary.1.0.0.symbols.nupkg" });

            var outputPackage = Path.Combine(outputDir.FullName, "TestLibrary.1.0.0.nupkg");
            var zip = ZipFile.Open(outputPackage, ZipArchiveMode.Read);
            zip.Entries.Should().Contain(e => e.FullName == "TestLibrary.nuspec");

            var manifestReader = new StreamReader(zip.Entries.First(e => e.FullName == "TestLibrary.nuspec").Open());
            var nuspecXml = XDocument.Parse(manifestReader.ReadToEnd());
            var node = nuspecXml.Descendants().Single(e => e.Name.LocalName == "serviceable");
            Assert.Equal("true", node.Value);
        }
开发者ID:akrisiun,项目名称:dotnet-cli,代码行数:27,代码来源:PackTests.cs

示例7: CopyToOutputFilesAreCopied

        public void CopyToOutputFilesAreCopied()
        {
            var testInstance = TestAssetsManager.CreateTestInstance("EndToEndTestApp")
                                                .WithLockFiles()
                                                .WithBuildArtifacts();

            var root = testInstance.TestRoot;

            // run compile
            var outputDir = Path.Combine(root, "bin");
            var testProject = ProjectUtils.GetProjectJson(root, "EndToEndTestApp");
            var buildCommand = new BuildCommand(testProject, output: outputDir, framework: DefaultFramework);
            var result = buildCommand.ExecuteWithCapturedOutput();
            result.Should().Pass();

            var outputDirInfo = new DirectoryInfo(Path.Combine(outputDir, "copy"));
            outputDirInfo.Should().HaveFile("file.txt");
            outputDirInfo.Should().NotHaveFile("fileex.txt");
        }
开发者ID:akrisiun,项目名称:dotnet-cli,代码行数:19,代码来源:CompilerTests.cs

示例8: EmbeddedResourcesAreCopied

        public void EmbeddedResourcesAreCopied()
        {
            var testInstance = TestAssetsManager.CreateTestInstance("EndToEndTestApp")
                                                .WithLockFiles()
                                                .WithBuildArtifacts();

            var root = testInstance.TestRoot;

            // run compile
            var outputDir = Path.Combine(root, "bin");
            var testProject = ProjectUtils.GetProjectJson(root, "EndToEndTestApp");
            var buildCommand = new BuildCommand(testProject, output: outputDir, framework: DefaultFramework);
            var result = buildCommand.ExecuteWithCapturedOutput();
            result.Should().Pass();

            var objDirInfo = new DirectoryInfo(Path.Combine(root, "obj", "Debug", DefaultFramework));
            objDirInfo.Should().HaveFile("EndToEndTestApp.resource1.resources");
            objDirInfo.Should().HaveFile("myresource.resources");
            objDirInfo.Should().HaveFile("EndToEndTestApp.defaultresource.resources");
        }
开发者ID:akrisiun,项目名称:dotnet-cli,代码行数:20,代码来源:CompilerTests.cs

示例9: It_builds_projects_with_xmlDoc_and_spaces_in_the_path

        public void It_builds_projects_with_xmlDoc_and_spaces_in_the_path()
        {
            var testInstance = TestAssetsManager
                .CreateTestInstance("TestLibraryWithXmlDoc", identifier: "With Space")
                .WithLockFiles();

            testInstance.TestRoot.Should().Contain(" ");

            var output = new DirectoryInfo(Path.Combine(testInstance.TestRoot, "output"));

            new BuildCommand("", output: output.FullName, framework: DefaultLibraryFramework)
                .WithWorkingDirectory(testInstance.TestRoot)
                .ExecuteWithCapturedOutput()
                .Should()
                .Pass();

            output.Should().HaveFiles(new[]
            {
                "TestLibraryWithXmlDoc.dll",
                "TestLibraryWithXmlDoc.xml"
            });
        }
开发者ID:akrisiun,项目名称:dotnet-cli,代码行数:22,代码来源:GivenDotnetBuildBuildsProjects.cs


注:本文中的System.IO.DirectoryInfo.Should方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。