本文整理汇总了C#中PackageReferenceFile.First方法的典型用法代码示例。如果您正苦于以下问题:C# PackageReferenceFile.First方法的具体用法?C# PackageReferenceFile.First怎么用?C# PackageReferenceFile.First使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PackageReferenceFile
的用法示例。
在下文中一共展示了PackageReferenceFile.First方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CanDetectMissingVersionAndUpdateToValid
public void CanDetectMissingVersionAndUpdateToValid()
{
var fileSystem = new MockFileSystem(@"d:\");
fileSystem.AddFile(@"d:\test\packages.config",
"<packages>" +
"<package id=\"Test\" version=\"1.0.0.0\" />" +
"<package id=\"Other\" version=\"1.0.0.0\" />" +
"</packages>");
var repository = new MockPackageRepository("http://test.com");
repository.AddPackage(PackageUtility.CreatePackage("Test", "2.0.0.0"));
repository.AddPackage(PackageUtility.CreatePackage("Other", "1.0.0.0"));
var command = new FixReferences(fileSystem, repository, new Console()) {Directory = @"d:\test"};
command.Execute();
var packageReferences = new PackageReferenceFile(fileSystem, @"d:\test\packages.config").GetPackageReferences().ToList();
Assert.AreEqual("2.0.0.0", packageReferences.First(p => p.Id == "Test").Version.Version.ToString());
Assert.AreEqual("1.0.0.0", packageReferences.First(p => p.Id == "Other").Version.Version.ToString());
}
示例2: ReferenceToPackageIdNotOnFeedStays
public void ReferenceToPackageIdNotOnFeedStays()
{
var fileSystem = new MockFileSystem(@"d:\");
fileSystem.AddFile(@"d:\test\packages.config",
"<packages>" +
"<package id=\"Missing\" version=\"1.0.0.0\" />" +
"</packages>");
var repository = new MockPackageRepository("http://test.com");
var command = new FixReferences(fileSystem, repository, new Console()) { Directory = @"d:\test" };
command.Execute();
var packageReferences = new PackageReferenceFile(fileSystem, @"d:\test\packages.config").GetPackageReferences().ToList();
Assert.AreEqual("1.0.0.0", packageReferences.First(p => p.Id == "Missing").Version.Version.ToString());
}