本文整理汇总了C#中NuGet.Test.Mocks.MockProjectSystem.DirectoryExists方法的典型用法代码示例。如果您正苦于以下问题:C# MockProjectSystem.DirectoryExists方法的具体用法?C# MockProjectSystem.DirectoryExists怎么用?C# MockProjectSystem.DirectoryExists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NuGet.Test.Mocks.MockProjectSystem
的用法示例。
在下文中一共展示了MockProjectSystem.DirectoryExists方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddRefreshFilesForAssembliesReferencesIncludeFilesUnderLibRoot
public void AddRefreshFilesForAssembliesReferencesIncludeFilesUnderLibRoot()
{
// Arrange
var projectSystem = new MockProjectSystem();
var projectSystemFactory = new Mock<IProjectSystemFactory>();
projectSystemFactory.Setup(p => p.CreateProjectSystem(It.IsAny<Project>(), It.IsAny<IFileSystemProvider>()))
.Returns(projectSystem);
var websiteHandler = new VsWebsiteHandler(null, projectSystemFactory.Object);
var packagesFileSystem = new MockFileSystem("x:\\some\\path");
packagesFileSystem.CreateDirectory("A.1.0");
packagesFileSystem.CreateDirectory("A.1.0\\lib");
packagesFileSystem.AddFile("A.1.0\\lib\\one.dll");
packagesFileSystem.AddFile("A.1.0\\lib\\two.winmd");
packagesFileSystem.CreateDirectory("B.3.0.0-beta");
packagesFileSystem.CreateDirectory("B.3.0.0-beta\\lib");
packagesFileSystem.AddFile("B.3.0.0-beta\\lib\\three.dll");
packagesFileSystem.AddFile("B.3.0.0-beta\\lib\\four.exe");
var properties = new MockDteProperties();
properties.AddProperty("FullPath", "x:\\project");
properties.AddProperty("TargetFrameworkMoniker", ".NETFramework,Version=v4.0");
var website = new Mock<Project>();
website.Setup(p => p.Kind).Returns(VsConstants.WebSiteProjectTypeGuid);
website.Setup(p => p.Properties).Returns(properties);
// Act
websiteHandler.AddRefreshFilesForReferences(
website.Object, packagesFileSystem, new[] { new PackageName("A", new SemanticVersion("1.0")),
new PackageName("B", new SemanticVersion("3.0.0-beta"))});
// Assert
Assert.True(projectSystem.DirectoryExists("bin"));
var refreshFiles = projectSystem.GetFiles("bin", "*.refresh").OrderBy(s => s).ToList();
Assert.Equal(4, refreshFiles.Count);
Assert.Equal("bin\\four.exe.refresh", refreshFiles[0]);
Assert.Equal("bin\\one.dll.refresh", refreshFiles[1]);
Assert.Equal("bin\\three.dll.refresh", refreshFiles[2]);
Assert.Equal("bin\\two.winmd.refresh", refreshFiles[3]);
}
示例2: CopyNativeBinariesForFilesUnderTheSameFolderName
public void CopyNativeBinariesForFilesUnderTheSameFolderName()
{
// Arrange
var projectSystem = new MockProjectSystem();
var projectSystemFactory = new Mock<IProjectSystemFactory>();
projectSystemFactory.Setup(p => p.CreateProjectSystem(It.IsAny<Project>(), It.IsAny<IFileSystemProvider>()))
.Returns(projectSystem);
var websiteHandler = new VsWebsiteHandler(null, projectSystemFactory.Object);
var packagesFileSystem = new MockFileSystem("x:\\some\\path");
packagesFileSystem.CreateDirectory("A.1.0");
packagesFileSystem.CreateDirectory("A.1.0\\nativebinaries");
packagesFileSystem.AddFile("A.1.0\\NativeBinaries\\one.dll");
packagesFileSystem.AddFile("A.1.0\\NativeBinaries\\two.winmd");
packagesFileSystem.CreateDirectory("B.3.0.0-beta");
packagesFileSystem.CreateDirectory("B.3.0.0-beta\\nativebinaries");
packagesFileSystem.AddFile("B.3.0.0-beta\\nativebinaries\\three.txt");
packagesFileSystem.AddFile("B.3.0.0-beta\\nativebinaries\\four.cd");
packagesFileSystem.CreateDirectory("B.3.0.0-beta\\lib");
packagesFileSystem.AddFile("B.3.0.0-beta\\lib\\forbidden.dll");
var website = new Mock<Project>();
website.Setup(p => p.Kind).Returns(VsConstants.WebSiteProjectTypeGuid);
// Act
websiteHandler.CopyNativeBinaries(
website.Object, packagesFileSystem, new[] { new PackageName("A", new SemanticVersion("1.0")),
new PackageName("B", new SemanticVersion("3.0.0-beta"))});
// Assert
Assert.True(projectSystem.DirectoryExists("bin"));
var nativeBinaries = projectSystem.GetFiles("bin", "*.*").OrderBy(s => s).ToList();
Assert.Equal(4, nativeBinaries.Count);
Assert.Equal("bin\\four.cd", nativeBinaries[0]);
Assert.Equal("bin\\one.dll", nativeBinaries[1]);
Assert.Equal("bin\\three.txt", nativeBinaries[2]);
Assert.Equal("bin\\two.winmd", nativeBinaries[3]);
}