Пример #1
0
        public async Task Should_repair_created_asset_if_not_found()
        {
            var @event = new AssetCreated {
                AppId = appId, AssetId = DomainId.NewGuid()
            };

            SetupEvent(@event);

            A.CallTo(() => assetFileStore.GetFileSizeAsync(appId.Id, @event.AssetId, 0, default))
            .Throws(new AssetNotFoundException("file"));

            await sut.RepairAsync();

            A.CallTo(() => assetFileStore.UploadAsync(appId.Id, @event.AssetId, 0, A <Stream> ._, default))
            .MustHaveHappened();
        }
Пример #2
0
        private async Task TryRepairAsync(NamedId <DomainId> appId, DomainId id, long fileVersion, CancellationToken ct)
        {
            try
            {
                await assetFileStore.GetFileSizeAsync(appId.Id, id, fileVersion, null, ct);
            }
            catch (AssetNotFoundException)
            {
                DummyStream.Position = 0;

                await assetFileStore.UploadAsync(appId.Id, id, fileVersion, null, DummyStream, ct : ct);
            }
        }