예제 #1
0
        public async Task Should_complete_reservation_with_previous_token()
        {
            const string appName = "my-app";

            var context = CreateRestoreContext();

            A.CallTo(() => appsIndex.ReserveAsync(appId, appName, ct))
            .Returns("Reservation");

            await sut.RestoreEventAsync(Envelope.Create(new AppCreated
            {
                Name = appName
            }), context, ct);

            await sut.CompleteRestoreAsync(context, appName);

            A.CallTo(() => appsIndex.RemoveReservationAsync("Reservation", default))
            .MustHaveHappened();

            A.CallTo(() => appsIndex.RegisterAsync(appId, appName, default))
            .MustHaveHappened();

            A.CallTo(() => rebuilder.InsertManyAsync <AppDomainObject, AppDomainObject.State>(A <IEnumerable <DomainId> > .That.Is(appId), 1, default))
            .MustHaveHappened();
        }
예제 #2
0
        public async Task CompleteRestoreAsync(RestoreContext context, string appName)
        {
            await rebuilder.InsertManyAsync <AppDomainObject, AppDomainObject.State>(Enumerable.Repeat(context.AppId, 1), 1, default);

            await appsIndex.RegisterAsync(context.AppId, appName);

            await appsIndex.RemoveReservationAsync(appReservation);
        }