Пример #1
0
        public async Task DeletePackageAsync_WithValidVersion_RemovesNupkgAndNuspecFromStorage(string version)
        {
            var catalogToDnxStorage        = new MemoryStorage();
            var catalogToDnxStorageFactory = new TestStorageFactory(name => catalogToDnxStorage.WithName(name));
            var maker = new DnxMaker(catalogToDnxStorageFactory);

            using (var nupkgStream = CreateFakePackageStream(_nupkgData))
            {
                var dnxEntry = await maker.AddPackageAsync(nupkgStream, _nuspecData, _packageId, version, CancellationToken.None);

                var storageForPackage = (MemoryStorage)catalogToDnxStorageFactory.Create(_packageId);

                Assert.Equal(2, catalogToDnxStorage.Content.Count);
                Assert.Equal(2, storageForPackage.Content.Count);

                await maker.DeletePackageAsync(_packageId, version, CancellationToken.None);

                Assert.Equal(0, catalogToDnxStorage.Content.Count);
                Assert.Equal(0, storageForPackage.Content.Count);
            }
        }