Exemple #1
0
        public virtual async Task SingleGrainWriteTransaction(string grainStates)
        {
            const int             delta = 5;
            ITransactionTestGrain grain = RandomTestGrain(grainStates);
            var original = await grain.Get();

            await grain.Add(delta);

            var expected = original.Select(value => value + delta).ToArray();
            var actual   = await grain.Get();

            Assert.Equal(expected, actual);
        }
        public virtual async Task SingleGrainWriteTransaction(string transactionTestGrainClassName)
        {
            const int             delta = 5;
            ITransactionTestGrain grain = RandomTestGrain(transactionTestGrainClassName);
            int original = await grain.Get();

            await grain.Add(delta);

            int expected = original + delta;
            int actual   = await grain.Get();

            Assert.Equal(expected, actual);
        }
        public virtual async Task SingleGrainWriteTransaction(string transactionTestGrainClassName)
        {
            const int             delta   = 5;
            Guid                  grainId = Guid.NewGuid();
            ITransactionTestGrain grain   = TestGrain(transactionTestGrainClassName, grainId);
            await grain.Get();

            await grain.Add(delta);

            await grain.Get();

            await CheckReport(grainId, 3, 0, 3);
        }
Exemple #4
0
        private async Task Double(ITransactionTestGrain grain)
        {
            int[] values = await grain.Get();

            await grain.Add(values[0]);
        }
Exemple #5
0
        public async Task AddAndThrow(ITransactionTestGrain grain, int numberToAdd)
        {
            await grain.Add(numberToAdd);

            throw new Exception("This should abort the transaction");
        }
Exemple #6
0
        public Task OrphanCallTransaction(ITransactionTestGrain grain)
        {
            Task t = grain.Add(1000);

            return(Task.CompletedTask);
        }