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


C# MockProjectSystem.AddImport方法代码示例

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


在下文中一共展示了MockProjectSystem.AddImport方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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"));
        }
开发者ID:riteshparekh,项目名称:NuGet,代码行数:26,代码来源:ProjectManagerTest.cs

示例2: 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"));
        }
开发者ID:riteshparekh,项目名称:NuGet,代码行数:27,代码来源:ProjectManagerTest.cs


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