Beispiel #1
0
        public async Task <AbsolutePath> Ingest(AbsolutePath file)
        {
            var hash = await file.FileHashAsync();

            if (HaveArchive(hash))
            {
                file.Delete();
                return(_archives[hash]);
            }

            var newPath = _settings.ArchivePath.Combine(hash.ToHex());
            await file.MoveToAsync(newPath);

            _archives[hash] = newPath;
            return(_archives[hash]);
        }
Beispiel #2
0
        public async Task DeletedFilesAreRemoved()
        {
            await AddFile(TEST_TXT, "This is a test");
            await AddTestRoot();

            var file = context.Index.ByRootPath[TEST_TXT];

            Assert.NotNull(file);

            Assert.Equal(14, file.Size);
            Assert.Equal(Hash.FromBase64("qX0GZvIaTKM="), file.Hash);

            TEST_TXT.Delete();

            await AddTestRoot();

            Assert.DoesNotContain(TEST_TXT, context.Index.AllFiles.Select(f => f.AbsoluteName));
        }