Exemplo n.º 1
0
        public async Task PackageIndexFile_RemoveAllPackagesVerifyFileRemoved()
        {
            using (var testContext = new SleetTestContext())
            {
                var inputA = TestUtility.GetPackageInput("a", testContext);
                var inputB = TestUtility.GetPackageInput("b", testContext);

                var file = new PackageIndexFile(testContext.SleetContext, "test.json", persistWhenEmpty: false);
                await file.AddPackageAsync(inputA);

                await file.AddPackageAsync(inputB);

                await file.RemovePackageAsync(inputA.Identity);

                await file.RemovePackageAsync(inputB.Identity);

                await testContext.Commit();

                var packages = await file.GetPackagesAsync();

                var path = Path.Combine(testContext.Target, "test.json");

                File.Exists(path).Should().BeFalse();
            }
        }
Exemplo n.º 2
0
        public async Task PackageIndexFile_RemovePackageVerifyRemove()
        {
            using (var testContext = new SleetTestContext())
            {
                var inputA = TestUtility.GetPackageInput("a", testContext);
                var inputB = TestUtility.GetPackageInput("b", testContext);

                var file = new PackageIndexFile(testContext.SleetContext, "test.json", persistWhenEmpty: true);
                await file.AddPackageAsync(inputA);

                await file.AddPackageAsync(inputB);

                await file.RemovePackageAsync(inputA.Identity);

                var packages = await file.GetPackagesAsync();

                packages.ShouldBeEquivalentTo(new[] { new PackageIdentity("b", NuGetVersion.Parse("1.0.0")) });

                var symbols = await file.GetSymbolsPackagesAsync();

                symbols.Should().BeEmpty();
            }
        }