public async Task Should_reserve_app_name() { const string appName = "my-app"; var context = CreateRestoreContext(); A.CallTo(() => appsIndex.ReserveAsync(appId, appName, A <CancellationToken> ._)) .Returns("Reservation"); await sut.RestoreEventAsync(Envelope.Create(new AppCreated { Name = appName }), context, ct); A.CallTo(() => appsIndex.ReserveAsync(appId, appName, A <CancellationToken> ._)) .MustHaveHappened(); }
private async Task ReserveAppAsync(Guid appId, string appName) { appReservation = await appsIndex.ReserveAsync(appId, appName); if (appReservation == null) { throw new BackupRestoreException("The app id or name is not available."); } }
private async Task ReserveAppAsync(DomainId appId, string appName, CancellationToken ct) { appReservation = await appsIndex.ReserveAsync(appId, appName, ct); if (appReservation == null) { throw new BackupRestoreException("The app id or name is not available."); } }