Ejemplo n.º 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();
        }
Ejemplo n.º 2
0
        public async Task Should_complete_reservation_with_previous_token()
        {
            const string appName = "my-app";

            var context = CreateRestoreContext();

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

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

            await sut.CompleteRestoreAsync(context);

            A.CallTo(() => index.AddAsync("Reservation"))
            .MustHaveHappened();
        }