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