Beispiel #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();
            }
        }
Beispiel #2
0
        public async Task PackageIndexFile_AddPackageVerifyAdd()
        {
            using (var testContext = new SleetTestContext())
            {
                var input = TestUtility.GetPackageInput("a", testContext);

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

                var packages = await file.GetPackagesAsync();

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

                var symbols = await file.GetSymbolsPackagesAsync();

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