Ejemplo n.º 1
0
        public async Task AbortTransactionOnOrphanCalls(string transactionTestGrainClassName)
        {
            const int expected = 5;

            ITransactionTestGrain        grain       = RandomTestGrain(transactionTestGrainClassName);
            ITransactionCoordinatorGrain coordinator = this.grainFactory.GetGrain <ITransactionCoordinatorGrain>(Guid.NewGuid());

            await grain.Set(expected);

            await Assert.ThrowsAsync <OrleansOrphanCallException>(() => coordinator.OrphanCallTransaction(grain));

            //await Task.Delay(20000); // give time for GC

            await TestAfterDustSettles(async() =>
            {
                int actual = await grain.Get();
                Assert.Equal(expected, actual);
            });
        }
        public async Task AbortTransactionOnOrphanCalls(TransactionTestConstants.TransactionGrainStates grainStates)
        {
            const int expected = 5;

            ITransactionTestGrain        grain       = RandomTestGrain(grainStates);
            ITransactionCoordinatorGrain coordinator = this.grainFactory.GetGrain <ITransactionCoordinatorGrain>(Guid.NewGuid());

            await grain.Set(expected);

            await Assert.ThrowsAsync <OrleansOrphanCallException>(() => coordinator.OrphanCallTransaction(grain));

            //await Task.Delay(20000); // give time for GC

            await TestAfterDustSettles(async() =>
            {
                int[] actualValues = await grain.Get();
                foreach (var actual in actualValues)
                {
                    Assert.Equal(expected, actual);
                }
            });
        }
        public virtual async Task AbortTransactionOnOrphanCalls(string grainStates)
        {
            const int expected = 5;

            ITransactionTestGrain        grain       = RandomTestGrain(grainStates);
            ITransactionCoordinatorGrain coordinator = this.grainFactory.GetGrain <ITransactionCoordinatorGrain>(Guid.NewGuid());

            await grain.Set(expected);

            Func <Task> task = () => coordinator.OrphanCallTransaction(grain);
            await task.Should().ThrowAsync <OrleansOrphanCallException>();

            //await Task.Delay(20000); // give time for GC

            await TestAfterDustSettles(async() =>
            {
                int[] actualValues = await grain.Get();
                foreach (var actual in actualValues)
                {
                    actual.Should().Be(expected);
                }
            });
        }