public AssetCommandMiddlewareTests() { file = new AssetFile("my-image.png", "image/png", 1024, () => stream); var assetDomainObject = new AssetDomainObject(Store, tagService, assetQuery, A.Dummy <ISemanticLog>()); A.CallTo(() => serviceProvider.GetService(typeof(AssetDomainObject))) .Returns(assetDomainObject); asset = new AssetDomainObjectGrain(serviceProvider, null !); 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.ShouldEnrichAsset()), AppId, A <string> .Ignored)) .Returns(new List <IEnrichedAssetEntity>()); A.CallTo(() => grainFactory.GetGrain <IAssetGrain>(Id, null)) .Returns(asset); sut = new AssetCommandMiddleware(grainFactory, assetEnricher, assetFileStore, assetQuery, contextProvider, new[] { assetMetadataSource }); }
public AssetCommandMiddlewareTests() { file = new NoopAssetFile(); var assetDomainObject = new AssetDomainObject(Store, A.Dummy <ISemanticLog>(), tagService, assetQuery, contentRepository); A.CallTo(() => serviceProvider.GetService(typeof(AssetDomainObject))) .Returns(assetDomainObject); asset = new AssetDomainObjectGrain(serviceProvider, null !); asset.ActivateAsync(Id.ToString()).Wait(); A.CallTo(() => contextProvider.Context) .Returns(requestContext); A.CallTo(() => assetEnricher.EnrichAsync(A <IAssetEntity> ._, requestContext)) .ReturnsLazily(() => SimpleMapper.Map(asset.Snapshot, new AssetEntity())); A.CallTo(() => assetQuery.FindByHashAsync(A <Context> ._, A <string> ._, A <string> ._, A <long> ._)) .Returns(Task.FromResult <IEnrichedAssetEntity?>(null)); A.CallTo(() => grainFactory.GetGrain <IAssetGrain>(Id.ToString(), null)) .Returns(asset); sut = new AssetCommandMiddleware(grainFactory, assetEnricher, assetFileStore, assetQuery, contextProvider, new[] { assetMetadataSource }); }
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 }); }
public AssetCommandMiddlewareTests() { file = new AssetFile("my-image.png", "image/png", 1024, () => stream); asset = new AssetGrain(Store); asset.ActivateAsync(Id).Wait(); A.CallTo(() => stateFactory.CreateAsync <AssetGrain>(Id)) .Returns(asset); sut = new AssetCommandMiddleware(stateFactory, assetStore, assetThumbnailGenerator); }
public AssetCommandMiddlewareTests() { file = new AssetFile("my-image.png", "image/png", 1024, () => stream); asset = new AssetGrain(Store, A.Dummy <ISemanticLog>()); asset.OnActivateAsync(Id).Wait(); A.CallTo(() => grainFactory.GetGrain <IAssetGrain>(Id, null)) .Returns(asset); sut = new AssetCommandMiddleware(grainFactory, assetStore, assetThumbnailGenerator); }
public AssetCommandMiddlewareTests() { file = new AssetFile("my-image.png", "image/png", 1024, () => stream); asset = new AssetGrain(Store, tagService, A.Dummy <ISemanticLog>()); asset.OnActivateAsync(Id).Wait(); A.CallTo(() => tagService.NormalizeTagsAsync(AppId, TagGroups.Assets, A <HashSet <string> > .Ignored, A <HashSet <string> > .Ignored)) .Returns(new HashSet <string>()); A.CallTo(() => grainFactory.GetGrain <IAssetGrain>(Id, null)) .Returns(asset); sut = new AssetCommandMiddleware(grainFactory, assetStore, assetThumbnailGenerator, new[] { tagGenerator }); }
public AssetCommandMiddlewareTests() { file = new AssetFile("my-image.png", "image/png", 1024, () => stream); sut = new AssetCommandMiddleware(Handler, assetStore, assetThumbnailGenerator); }