public ShowLatestVersionQueryContext(SourceRepository sourceRepository, string?search, bool showPreReleasePackages, int pageSize, PackageListCache <T> packageListCache)
 {
     _sourceRepository     = sourceRepository;
     _searchContext        = new SearchContext(search, new SearchFilter(showPreReleasePackages));
     _pageSize             = pageSize;
     _packageListCache     = packageListCache ?? throw new ArgumentNullException(nameof(packageListCache));
     _localPackageSearcher = new LocalPackageSearcher <T>(_searchContext);
 }
Beispiel #2
0
        public void LockedTag()
        {
            TestPackage testPackage = PackageHelper.CreatePackage(this.Settings);

            IMemoryCache     _memoryCache     = MemoryCacheHelper.GetInstance();
            PackageListCache PackageListCache = new PackageListCache(_memoryCache);
            ITagsService     tagsService      = new Core.TagsService(this.Settings, new TestLogger <ITagsService>(), PackageListCache);

            tagsService.AddTag(testPackage.Name, "mytag");

            string[] tagDirectories = Directory.GetDirectories(Path.Join(this.Settings.TagsPath));
            Assert.Single(tagDirectories); // should be 1 only

            string[] tagSubscribers = Directory.GetFiles(tagDirectories.First());
            Assert.Single(tagSubscribers); // should be 1 only

            // lock the tag by opening a read stream on it
            using (new FileStream(tagSubscribers.First(), FileMode.Open, FileAccess.Read, FileShare.Read))
            {
                // no need to assert, this test is for coverage, and all we want is no exception to be thrown here
                this.IndexReader.DeletePackage(testPackage.Name);
            }
        }