Пример #1
0
        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();
        }
Пример #2
0
        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.");
            }
        }
Пример #3
0
        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.");
            }
        }