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


C# MockFileSystem.DeleteFile方法代码示例

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


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

示例1: ConfigurationCacheIsClearedIfFileRemoved

        public void ConfigurationCacheIsClearedIfFileRemoved()
        {
            // Arrange
            var solutionManager = new Mock<ISolutionManager>();
            solutionManager.Setup(m => m.SolutionDirectory).Returns(@"bar\baz");
            var fileSystem = new MockFileSystem();
            fileSystem.AddFile(@"bar\nuget.config", @"
            <settings>
            <repositoryPath>lib</repositoryPath>
            </settings>");
            var fileSystemProvider = new Mock<IFileSystemProvider>();
            fileSystemProvider.Setup(m => m.GetFileSystem(@"bar\baz")).Returns(fileSystem);
            var repositorySettings = new RepositorySettings(solutionManager.Object, fileSystemProvider.Object);

            // Act
            string p1 = repositorySettings.RepositoryPath;

            fileSystem.DeleteFile(@"bar\nuget.config");

            string p2 = repositorySettings.RepositoryPath;

            // Assert
            Assert.AreEqual(@"bar\lib", p1);
            Assert.AreEqual(@"bar\baz\packages", p2);
        }
开发者ID:larsw,项目名称:nuget,代码行数:25,代码来源:RepositorySettingsTest.cs

示例2: IsValidIsTrueWhenNupkgFileIsDeleted

        public void IsValidIsTrueWhenNupkgFileIsDeleted()
        {
            // Arrange
            var ms = GetPackageStream();

            var fileSystem = new MockFileSystem("x:\\");
            fileSystem.AddFile("pam.nupkg", ms);

            var expandedFileSystem = new MockFileSystem("y:\\");

            var ozp = new TestableOptimizedZipPackage(fileSystem, "pam.nupkg", expandedFileSystem);
            Assert.True(ozp.IsValid);

            // Act
            fileSystem.DeleteFile("pam.nupkg");

            // Assert
            Assert.False(ozp.IsValid);
        }
开发者ID:Newtopian,项目名称:nuget,代码行数:19,代码来源:OptimizedZipPackageTest.cs

示例3: FindPackageVerifiesPackageFileExistsOnFileSystemWhenCaching

        public void FindPackageVerifiesPackageFileExistsOnFileSystemWhenCaching()
        {
            // Arrange
            var fileSystem = new MockFileSystem();
            fileSystem.AddFile(@"A.1.0.0.nupkg");

            var repository = new LocalPackageRepository(new DefaultPackagePathResolver(fileSystem, useSideBySidePaths: true), fileSystem, enableCaching: true);
            var searchedPaths = new List<string>();
            Func<string, IPackage> openPackage = p =>
            {
                searchedPaths.Add(p);
                return PackageUtility.CreatePackage("A", "1.0");
            };

            // Act - 1
            IPackage result = repository.FindPackage(openPackage, "A", new SemanticVersion("1.0"));

            // Assert - 1
            Assert.NotNull(result);
            Assert.Equal("A", result.Id);
            Assert.Equal(new SemanticVersion("1.0"), result.Version);

            // Act - 2
            fileSystem.DeleteFile("A.1.0.0.nupkg");
            result = repository.FindPackage(openPackage, "A", new SemanticVersion("1.0"));

            // Assert - 2
            Assert.Null(result);
        }
开发者ID:sistoimenov,项目名称:NuGet2,代码行数:29,代码来源:LocalPackageRepositoryTest.cs


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