本文整理汇总了C#中NuGet.Test.Mocks.MockProjectSystem.ImportExists方法的典型用法代码示例。如果您正苦于以下问题:C# MockProjectSystem.ImportExists方法的具体用法?C# MockProjectSystem.ImportExists怎么用?C# MockProjectSystem.ImportExists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NuGet.Test.Mocks.MockProjectSystem
的用法示例。
在下文中一共展示了MockProjectSystem.ImportExists方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RemovingPackageDoesNotRemoveImportFileIfFilePatternDoesNotMatch
public void RemovingPackageDoesNotRemoveImportFileIfFilePatternDoesNotMatch()
{
// Arrange
var sourceRepository = new MockPackageRepository();
var projectSystem = new MockProjectSystem(new FrameworkName(".NETFramework, Version=4.5"), "x:\\root");
projectSystem.AddImport(@"x:\root\A.1.0\content\net35\A.props", ProjectImportLocation.Top);
projectSystem.AddImport(@"x:\root\A.1.0\content\net35\A.targets", ProjectImportLocation.Bottom);
var projectManager = new ProjectManager(sourceRepository, new DefaultPackagePathResolver(projectSystem), projectSystem, new MockPackageRepository());
IPackage packageA = PackageUtility.CreatePackage(
"A",
"1.0",
content: new[] { "net35\\A.1.0.props", "net35\\B.targets" });
projectManager.LocalRepository.AddPackage(packageA);
sourceRepository.AddPackage(packageA);
// Act
projectManager.RemovePackageReference("A");
// Assert
Assert.False(projectManager.LocalRepository.Exists(packageA));
Assert.True(projectSystem.ImportExists(@"x:\root\A.1.0\content\net35\A.props"));
Assert.True(projectSystem.ImportExists(@"x:\root\A.1.0\content\net35\A.targets"));
}
示例2: AddPackageReferenceDoesNotImportsTargetOrPropFileThatAreNotAtContentRoot
public void AddPackageReferenceDoesNotImportsTargetOrPropFileThatAreNotAtContentRoot()
{
// Arrange
var projectSystem = new MockProjectSystem(new FrameworkName("Native", new Version("2.0")), "x:\\root");
var localRepository = new MockPackageRepository();
var mockRepository = new MockPackageRepository();
var projectManager = new ProjectManager(mockRepository, new DefaultPackagePathResolver(projectSystem), projectSystem, localRepository);
var packageA = PackageUtility.CreatePackage("A", "1.0");
var mockPackageA = Mock.Get(packageA);
var files = PackageUtility.CreateFiles(new[] { "build\\native\\foo\\A.targets", "build\\native\\bar\\B.props", "content\\native\\foo.css" });
mockPackageA.Setup(p => p.GetFiles()).Returns(files);
mockRepository.AddPackage(mockPackageA.Object);
// Act
projectManager.AddPackageReference("A");
// Assert
Assert.True(localRepository.Exists("A"));
Assert.False(projectSystem.ImportExists("x:\\root\\A.1.0\\build\\native\\foo\\A.targets"));
Assert.False(projectSystem.ImportExists("x:\\root\\A.1.0\\build\\native\\bar\\A.props"));
}
示例3: RemovingPackageRemoveImportFile
public void RemovingPackageRemoveImportFile()
{
// Arrange
var sourceRepository = new MockPackageRepository();
var projectSystem = new MockProjectSystem(new FrameworkName(".NETFramework, Version=4.5"), "x:\\root");
projectSystem.AddImport(@"x:\root\A.1.0\build\net35\A.props", ProjectImportLocation.Top);
projectSystem.AddImport(@"x:\root\A.1.0\build\net35\A.targets", ProjectImportLocation.Bottom);
var projectManager = new ProjectManager(sourceRepository, new DefaultPackagePathResolver(projectSystem), projectSystem, new MockPackageRepository());
IPackage packageA = PackageUtility.CreatePackage("A", "1.0");
var mockPackageA = Mock.Get(packageA);
var files = PackageUtility.CreateFiles(new[] { "build\\net35\\A.targets", "build\\net35\\a.props" });
mockPackageA.Setup(p => p.GetFiles()).Returns(files);
projectManager.LocalRepository.AddPackage(packageA);
sourceRepository.AddPackage(packageA);
// Act
projectManager.RemovePackageReference("A");
// Assert
Assert.False(projectManager.LocalRepository.Exists(packageA));
Assert.False(projectSystem.ImportExists(@"x:\root\A.1.0\content\net35\A.props"));
Assert.False(projectSystem.ImportExists(@"x:\root\A.1.0\content\net35\A.targets"));
}