private static async Task <BankAccountGrainState> ActiveStateProcessor(
     BankAccountGrainState state,
     BankAccountMessage message)
 =>
 await
 message.Match(
     HandleInvalidMessage,
     ActiveStateMessageDelegator.HandleActiveStateDepositMessage(state),
     ActiveStateMessageDelegator.HandleActiveStateWithdrawMessage(state));
        private static async Task <BankAccountGrainState> OverdrawnStateProcessor(
            BankAccountGrainState state,
            BankAccountMessage message)
        {
            var messageHandler = new OverdrawnStateMessageHandler();

            return
                (await
                 message.Match(
                     () => { throw new InvalidMessage(); },
                     _ => messageHandler.Deposit(state, _),
                     _ => { throw new InvalidMessage(); }));
        }
Example #3
0
        private static async Task <BankAccountGrainState> ZeroBalanceStateProcessor(
            BankAccountGrainState state,
            BankAccountMessage message)
        {
            var messageHandler = new ZeroBalanceStateMessageHandler();

            return
                (await
                 message.Match(
                     () => messageHandler.Close(state),
                     _ => messageHandler.Deposit(state, _),
                     _ => messageHandler.Withdraw(state, _)));
        }
Example #4
0
 private static Task <BankAccountGrainState> ClosedStateProcessor(
     BankAccountGrainState state,
     BankAccountMessage message)
 {
     throw new InvalidMessage(message);
 }