Example #1
0
        public async Task Test_AllRandom()
        {
            var generatorFactory = new GalleryGeneratorFactory(new TagRepositoryMock(), new PictureRepositoryMock(), new GalleryRepositoryMock());

            var galleryDescriptor = GalleryDescriptor.Create(10);

            var generator = generatorFactory.GetGalleryGenerator(galleryDescriptor);
            var gallery   = await generator.GenerateGallery();

            Assert.IsTrue(gallery.GalleryItems.Count == 10);
        }
Example #2
0
        public async Task TestOnlyGifs()
        {
            var generatorFactory = new GalleryGeneratorFactory(new TagRepositoryMock(), new PictureRepositoryMock(), new GalleryRepositoryMock());

            var galleryDescriptor = GalleryDescriptor.Create(1, "onlygifs");

            var generator = generatorFactory.GetGalleryGenerator(galleryDescriptor);
            var gallery   = await generator.GenerateGallery();

            Assert.IsTrue(gallery.GalleryItems.Count > 0);
        }
Example #3
0
        public async Task <GalleryResponse> GetCustomizedRandom(int itemsInGallery, string tags, string tagFilteringMode, string mediaFilterMode)
        {
            GalleryDescriptor descriptor = GalleryDescriptor.Create(itemsInGallery, mediaFilterMode);

            if (!string.IsNullOrWhiteSpace(tagFilteringMode))
            {
                descriptor.SetTagFilter(tags, tagFilteringMode);
            }

            var galleryGenerator = _galleryGeneratorFactory.GetGalleryGenerator(descriptor);

            var aggregate = await galleryGenerator.GenerateGallery();

            return(_mapper.Map <GalleryResponse>(aggregate));
        }