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


C# MockPackageRepository.ResolveDependency方法代码示例

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


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

示例1: 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.ResolveDependency(dependency, allowPrereleaseVersions: false, preferListedPackages: false);

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

示例2: 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.ResolveDependency(dependency1, allowPrereleaseVersions: false, preferListedPackages: false);
            IPackage package2 = repository.ResolveDependency(dependency2, allowPrereleaseVersions: false, preferListedPackages: false);
            IPackage package3 = repository.ResolveDependency(dependency3, allowPrereleaseVersions: false, preferListedPackages: false);
            IPackage package4 = repository.ResolveDependency(dependency4, allowPrereleaseVersions: false, preferListedPackages: false);
            IPackage package5 = repository.ResolveDependency(dependency5, allowPrereleaseVersions: false, preferListedPackages: false);

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

示例3: FindDependencyPicksHighestMinor

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

            // 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 && <= 2.0
            PackageDependency dependency5 = PackageDependency.CreateDependency("B", "[1.0.0, 2.0]");

            // Act
            IPackage package1 = repository.ResolveDependency(
                dependency1, constraintProvider: null, allowPrereleaseVersions: false,
                preferListedPackages: false, dependencyVersion: DependencyVersion.HighestMinor);
            IPackage package2 = repository.ResolveDependency(
                dependency2, constraintProvider: null, allowPrereleaseVersions: false,
                preferListedPackages: false, dependencyVersion: DependencyVersion.HighestMinor);
            IPackage package3 = repository.ResolveDependency(
                dependency3, constraintProvider: null, allowPrereleaseVersions: false,
                preferListedPackages: false, dependencyVersion: DependencyVersion.HighestMinor);
            IPackage package4 = repository.ResolveDependency(
                dependency4, constraintProvider: null, allowPrereleaseVersions: false,
                preferListedPackages: false, dependencyVersion: DependencyVersion.HighestMinor);
            IPackage package5 = repository.ResolveDependency(
                dependency5, constraintProvider: null, allowPrereleaseVersions: false,
                preferListedPackages: false, dependencyVersion: DependencyVersion.HighestMinor);

            // Assert
            Assert.Equal("B", package1.Id);
            Assert.Equal(new SemanticVersion("1.1"), package1.Version);
            Assert.Equal("B", package2.Id);
            Assert.Equal(new SemanticVersion("1.1"), package2.Version);
            Assert.Equal("B", package3.Id);
            Assert.Equal(new SemanticVersion("1.1"), package3.Version);
            Assert.Equal("B", package4.Id);
            Assert.Equal(new SemanticVersion("1.0"), package4.Version);
            Assert.Equal("B", package5.Id);
            Assert.Equal(new SemanticVersion("1.1"), package5.Version);
        }
开发者ID:Newtopian,项目名称:nuget,代码行数:56,代码来源:PackageRepositoryTest.cs


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