public ResolveAssetsTests() { requestContext = new Context(Mocks.FrontendUser(), Mocks.App(appId, Language.DE)); var schemaDef = new Schema(schemaId.Name) .AddAssets(1, "asset1", Partitioning.Invariant, new AssetsFieldProperties { ResolveFirst = true, MinItems = 2, MaxItems = 3 }) .AddAssets(2, "asset2", Partitioning.Language, new AssetsFieldProperties { ResolveFirst = true, MinItems = 1, MaxItems = 1 }) .SetFieldsInLists("asset1", "asset2"); A.CallTo(() => urlGenerator.AssetContent(appId, A <string> ._)) .ReturnsLazily(ctx => $"url/to/{ctx.GetArgument<string>(1)}"); schemaProvider = x => { if (x == schemaId.Id) { return(Task.FromResult(Mocks.Schema(appId, schemaId, schemaDef))); } else { throw new DomainObjectNotFoundException(x.ToString()); } }; sut = new ResolveAssets(urlGenerator, assetQuery, requestCache); }
public ResolveAssetsTests() { requestContext = new Context(Mocks.FrontendUser(), Mocks.App(appId, Language.DE)); var schemaDef = new Schema(schemaId.Name) .AddAssets(1, "asset1", Partitioning.Invariant, new AssetsFieldProperties { ResolveImage = true, MinItems = 2, MaxItems = 3 }) .AddAssets(2, "asset2", Partitioning.Language, new AssetsFieldProperties { ResolveImage = true, MinItems = 1, MaxItems = 1 }) .SetFieldsInLists("asset1", "asset2"); A.CallTo(() => assetUrlGenerator.GenerateUrl(A <string> .Ignored)) .ReturnsLazily(new Func <string, string>(id => $"url/to/{id}")); schemaProvider = x => { if (x == schemaId.Id) { return(Task.FromResult(Mocks.Schema(appId, schemaId, schemaDef))); } else { throw new DomainObjectNotFoundException(x.ToString(), typeof(ISchemaEntity)); } }; sut = new ResolveAssets(assetUrlGenerator, assetQuery, requestCache); }