本文整理汇总了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);
}
示例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);
}