public async Task AbortTransactionOnExceptions(string transactionTestGrainClassName) { const int expected = 5; ITransactionTestGrain grain = RandomTestGrain(transactionTestGrainClassName); ITransactionCoordinatorGrain coordinator = this.grainFactory.GetGrain <ITransactionCoordinatorGrain>(Guid.NewGuid()); await coordinator.MultiGrainSet(new List <ITransactionTestGrain> { grain }, expected); await Assert.ThrowsAsync <OrleansTransactionAbortedException>(() => coordinator.AddAndThrow(grain, expected)); await TestAfterDustSettles(async() => { int actual = await grain.Get(); Assert.Equal(expected, actual); }); }
public async Task AbortTransactionOnExceptions(TransactionTestConstants.TransactionGrainStates grainStates) { const int expected = 5; ITransactionTestGrain grain = RandomTestGrain(grainStates); ITransactionCoordinatorGrain coordinator = this.grainFactory.GetGrain <ITransactionCoordinatorGrain>(Guid.NewGuid()); await coordinator.MultiGrainSet(new List <ITransactionTestGrain> { grain }, expected); await Assert.ThrowsAsync <OrleansTransactionAbortedException>(() => coordinator.AddAndThrow(grain, expected)); await TestAfterDustSettles(async() => { int[] actualValues = await grain.Get(); foreach (var actual in actualValues) { Assert.Equal(expected, actual); } }); }
public virtual async Task AbortTransactionOnExceptions(string grainStates) { const int expected = 5; ITransactionTestGrain grain = RandomTestGrain(grainStates); ITransactionCoordinatorGrain coordinator = this.grainFactory.GetGrain <ITransactionCoordinatorGrain>(Guid.NewGuid()); await coordinator.MultiGrainSet(new List <ITransactionTestGrain> { grain }, expected); Func <Task> task = () => coordinator.AddAndThrow(grain, expected); await task.Should().ThrowAsync <OrleansTransactionAbortedException>(); await TestAfterDustSettles(async() => { int[] actualValues = await grain.Get(); foreach (var actual in actualValues) { actual.Should().Be(expected); } }); }