Example #1
0
        public AssetCommandMiddlewareTests()
        {
            file = new AssetFile("my-image.png", "image/png", 1024, () => stream);

            asset = new AssetGrain(Store, tagService, assetQuery, A.Fake <IActivationLimit>(), A.Dummy <ISemanticLog>());
            asset.ActivateAsync(Id).Wait();

            A.CallTo(() => contextProvider.Context)
            .Returns(requestContext);

            A.CallTo(() => assetEnricher.EnrichAsync(A <IAssetEntity> .Ignored, requestContext))
            .ReturnsLazily(() => SimpleMapper.Map(asset.Snapshot, new AssetEntity()));

            A.CallTo(() => assetQuery.QueryByHashAsync(A <Context> .That.Matches(x => x.IsNoAssetEnrichment()), AppId, A <string> .Ignored))
            .Returns(new List <IEnrichedAssetEntity>());

            A.CallTo(() => grainFactory.GetGrain <IAssetGrain>(Id, null))
            .Returns(asset);

            A.CallTo(() => assetThumbnailGenerator.GetImageInfoAsync(stream))
            .Returns(image);

            sut = new AssetCommandMiddleware(grainFactory,
                                             assetEnricher,
                                             assetQuery,
                                             assetStore,
                                             assetThumbnailGenerator,
                                             contextProvider, new[] { tagGenerator });
        }
Example #2
0
        public AssetGrainTests()
        {
            A.CallTo(() => tagService.NormalizeTagsAsync(AppId, TagGroups.Assets, A <HashSet <string> > .Ignored, A <HashSet <string> > .Ignored))
            .Returns(new Dictionary <string, string>());

            sut = new AssetGrain(Store, tagService, A.Dummy <ISemanticLog>());
            sut.ActivateAsync(Id).Wait();
        }
Example #3
0
        public AssetGrainTests()
        {
            A.CallTo(() => assetQuery.FindAssetFolderAsync(parentId))
            .Returns(new List <IAssetFolderEntity> {
                A.Fake <IAssetFolderEntity>()
            });

            A.CallTo(() => tagService.NormalizeTagsAsync(AppId, TagGroups.Assets, A <HashSet <string> > .Ignored, A <HashSet <string> > .Ignored))
            .ReturnsLazily(x => Task.FromResult(x.GetArgument <HashSet <string> >(2)?.ToDictionary(x => x) !));

            sut = new AssetGrain(Store, tagService, assetQuery, limit, A.Dummy <ISemanticLog>());
            sut.ActivateAsync(Id).Wait();
        }
        public AssetCommandMiddlewareTests()
        {
            file = new AssetFile("my-image.png", "image/png", 1024, () => stream);

            asset = new AssetGrain(Store, tagService, A.Dummy <ISemanticLog>());
            asset.ActivateAsync(Id).Wait();

            A.CallTo(() => tagService.NormalizeTagsAsync(AppId, TagGroups.Assets, A <HashSet <string> > .Ignored, A <HashSet <string> > .Ignored))
            .Returns(new Dictionary <string, string>());

            A.CallTo(() => grainFactory.GetGrain <IAssetGrain>(Id, null))
            .Returns(asset);

            sut = new AssetCommandMiddleware(grainFactory, assetStore, assetThumbnailGenerator, new[] { tagGenerator });
        }