public async Task HasPackageInIndexAsync_WhenPackageIdAndVersionDoNotExist_ReturnsFalse() { var catalogToDnxStorage = new MemoryStorage(); var catalogToDnxStorageFactory = new TestStorageFactory(name => catalogToDnxStorage.WithName(name)); var maker = new DnxMaker(catalogToDnxStorageFactory); var storageForPackage = (MemoryStorage)catalogToDnxStorageFactory.Create(_packageId); var hasPackageInIndex = await maker.HasPackageInIndexAsync(storageForPackage, _packageId, "1.0.0", CancellationToken.None); Assert.False(hasPackageInIndex); }
public async Task HasPackageInIndexAsync_WhenPackageIdExistsButVersionDoesNotExist_ReturnsFalse() { var catalogToDnxStorage = new MemoryStorage(); var catalogToDnxStorageFactory = new TestStorageFactory(name => catalogToDnxStorage.WithName(name)); var maker = new DnxMaker(catalogToDnxStorageFactory, Mock.Of <ITelemetryService>(), Mock.Of <ILogger>()); await maker.UpdatePackageVersionIndexAsync(_packageId, v => v.Add(NuGetVersion.Parse("1.0.0")), CancellationToken.None); var storageForPackage = (MemoryStorage)catalogToDnxStorageFactory.Create(_packageId); var hasPackageInIndex = await maker.HasPackageInIndexAsync(storageForPackage, _packageId, "2.0.0", CancellationToken.None); Assert.False(hasPackageInIndex); }
public async Task HasPackageInIndexAsync_WhenPackageIdAndVersionExist_ReturnsTrue() { var catalogToDnxStorage = new MemoryStorage(); var catalogToDnxStorageFactory = new TestStorageFactory(name => catalogToDnxStorage.WithName(name)); var maker = new DnxMaker(catalogToDnxStorageFactory); const string version = "1.0.0"; await maker.UpdatePackageVersionIndexAsync(_packageId, v => v.Add(NuGetVersion.Parse(version)), CancellationToken.None); var storageForPackage = (MemoryStorage)catalogToDnxStorageFactory.Create(_packageId); var hasPackageInIndex = await maker.HasPackageInIndexAsync(storageForPackage, _packageId, version, CancellationToken.None); Assert.True(hasPackageInIndex); }