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


C# MockPackageRepository.FindDependency方法代码示例

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


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

示例1: FindDependencyPicksLowestMajorAndMinorVersionButHighestBuildAndRevision

        public void FindDependencyPicksLowestMajorAndMinorVersionButHighestBuildAndRevision()
        {
            // Arrange
            var repository = new MockPackageRepository() {
                PackageUtility.CreatePackage("B", "2.0"),
                PackageUtility.CreatePackage("B", "1.0"),
                PackageUtility.CreatePackage("B", "1.0.1"),
                PackageUtility.CreatePackage("B", "1.0.9"),
                PackageUtility.CreatePackage("B", "1.1")
            };

            // B >= 1.0
            PackageDependency dependency1 = PackageDependency.CreateDependency("B", "1.0");

            // B >= 1.0.0
            PackageDependency dependency2 = PackageDependency.CreateDependency("B", "1.0.0");

            // B >= 1.0.0.0
            PackageDependency dependency3 = PackageDependency.CreateDependency("B", "1.0.0.0");

            // B = 1.0
            PackageDependency dependency4 = PackageDependency.CreateDependency("B", "[1.0]");

            // B >= 1.0.0 && <= 1.0.8
            PackageDependency dependency5 = PackageDependency.CreateDependency("B", "[1.0.0, 1.0.8]");

            // Act
            IPackage package1 = repository.FindDependency(dependency1);
            IPackage package2 = repository.FindDependency(dependency2);
            IPackage package3 = repository.FindDependency(dependency3);
            IPackage package4 = repository.FindDependency(dependency4);
            IPackage package5 = repository.FindDependency(dependency5);

            // Assert
            Assert.AreEqual("B", package1.Id);
            Assert.AreEqual(new Version("1.0.9"), package1.Version);
            Assert.AreEqual("B", package2.Id);
            Assert.AreEqual(new Version("1.0.9"), package2.Version);
            Assert.AreEqual("B", package3.Id);
            Assert.AreEqual(new Version("1.0.9"), package3.Version);
            Assert.AreEqual("B", package4.Id);
            Assert.AreEqual(new Version("1.0"), package4.Version);
            Assert.AreEqual("B", package5.Id);
            Assert.AreEqual(new Version("1.0.1"), package5.Version);
        }
开发者ID:larsw,项目名称:nuget,代码行数:45,代码来源:PackageRepositoryTest.cs

示例2: FindDependencyPicksHighestVersionIfNotSpecified

        public void FindDependencyPicksHighestVersionIfNotSpecified()
        {
            // Arrange
            var repository = new MockPackageRepository() {
                PackageUtility.CreatePackage("B", "2.0"),
                PackageUtility.CreatePackage("B", "1.0"),
                PackageUtility.CreatePackage("B", "1.0.1"),
                PackageUtility.CreatePackage("B", "1.0.9"),
                PackageUtility.CreatePackage("B", "1.1")
            };

            var dependency = new PackageDependency("B");

            // Act
            IPackage package = repository.FindDependency(dependency);

            // Assert
            Assert.AreEqual("B", package.Id);
            Assert.AreEqual(new Version("2.0"), package.Version);
        }
开发者ID:larsw,项目名称:nuget,代码行数:20,代码来源:PackageRepositoryTest.cs


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