public async Task CanInstall(FrameworkName targetFramework, PackageInstallData data) { var project = CreatePackageManager(targetFramework); await project.InstallPackageAsync( new InteractivePackage (new PackageIdentity(data.Id, data.VersionToInstall)), sourceRepository : null, // use default cancellationToken : CancellationToken.None); Assert.Collection( project.InstalledPackages.Where( p => PackageIdComparer.Equals(p.Identity.Id, data.Id)), package => { Assert.True(package.IsExplicit); Assert.Equal(data.ExpectedInstalled, package.Identity.Version); Assert.Equal(new VersionRange(data.ExpectedInstalled), package.SupportedVersionRange); }); }
public async Task CanInstall(FrameworkName targetFramework, PackageInstallData data) { var project = CreatePackageManager(targetFramework); await project.InstallPackageAsync( new InteractivePackage (new PackageIdentity(data.Id, data.VersionToInstall)), sourceRepository : null, // use default cancellationToken : CancellationToken.None); var packages = project.InstalledPackages.Where( p => PackageIdComparer.Equals(p.Identity.Id, data.Id)); packages.Count().ShouldEqual(1); var package = packages.Single(); package.IsExplicit.ShouldBeTrue(); package.Identity.Version.ShouldEqual(data.ExpectedInstalled); package.SupportedVersionRange.ShouldEqual(new VersionRange(data.ExpectedInstalled)); }