コード例 #1
0
        private async Task WithdrawTransferableShouldSucceed(NxtTransferable transferable, string unit, bool supportedTransferable = true)
        {
            const decimal nxtBalance     = 1M;
            const decimal balance        = 100M;
            const decimal withdrawAmount = 42;

            SetupNxtAccount(TestConstants.SenderAccount, nxtBalance);
            SetupTransferable(transferable, balance, TestConstants.SenderAccount.NxtAccountRs, supportedTransferable);
            nxtConnectorMock.Setup(c => c.Transfer(
                                       It.Is <NxtAccount>(a => a == TestConstants.SenderAccount),
                                       It.Is <string>(r => r == TestConstants.RecipientAccount.NxtAccountRs),
                                       It.Is <NxtTransferable>(tran => tran == transferable),
                                       It.Is <decimal>(amount => amount == withdrawAmount),
                                       It.IsAny <string>(),
                                       It.IsAny <string>()))
            .ReturnsAsync(txId);

            await slackHandler.InstantMessageCommand($"withdraw {TestConstants.RecipientAccount.NxtAccountRs} {withdrawAmount} {unit}", slackUser, imSession);

            slackConnectorMock.Verify(c => c.SendMessage(imSession.Id,
                                                         It.Is <string>(input => input.Equals(MessageConstants.Withdraw(withdrawAmount, transferable.Name, txId))), false));
        }
コード例 #2
0
        public async Task TryWithdrawNxt(string message, decimal withdrawAmount)
        {
            const decimal balance = 400;
            const ulong   txId    = 928347;

            SetupNxtAccount(TestConstants.SenderAccount, balance);
            nxtConnectorMock.Setup(c => c.Transfer(
                                       It.Is <NxtAccount>(a => a == TestConstants.SenderAccount),
                                       It.Is <string>(r => r == TestConstants.RecipientAccount.NxtAccountRs),
                                       It.Is <NxtTransferable>(t => t == Nxt.Singleton),
                                       It.Is <decimal>(amount => amount == withdrawAmount),
                                       It.IsAny <string>(),
                                       It.IsAny <string>()))
            .ReturnsAsync(txId);

            await slackHandler.InstantMessageCommand(message, slackUser, imSession);

            slackConnectorMock.Verify(c => c.SendMessage(imSession.Id,
                                                         It.Is <string>(input => input.Equals(MessageConstants.Withdraw(withdrawAmount, "NXT", txId))), false));
        }