Exemple #1
0
        public async Task Should_write_asset_urls()
        {
            var me = new RefToken(RefTokenType.Subject, "123");

            var assetsUrl    = "https://old.squidex.com/api/assets/";
            var assetsUrlApp = "https://old.squidex.com/api/assets/my-app";

            A.CallTo(() => urlGenerator.AssetContentBase())
            .Returns(assetsUrl);

            A.CallTo(() => urlGenerator.AssetContentBase(appId.Name))
            .Returns(assetsUrlApp);

            var writer = A.Fake <IBackupWriter>();

            var context = new BackupContext(appId.Id, new UserMapping(me), writer);

            await sut.BackupEventAsync(Envelope.Create(new AppCreated
            {
                Name = appId.Name
            }), context);

            A.CallTo(() => writer.WriteJsonAsync(A <string> ._,
                                                 A <BackupContents.Urls> .That.Matches(x =>
                                                                                       x.Assets == assetsUrl &&
                                                                                       x.AssetsApp == assetsUrlApp)))
            .MustHaveHappened();
        }
Exemple #2
0
 private Urls GetUrls(string appName)
 {
     return(new Urls
     {
         Assets = urlGenerator.AssetContentBase(),
         AssetsApp = urlGenerator.AssetContentBase(appName)
     });
 }