コード例 #1
0
        public void ShouldChangeBalanceAmount()
        {
            // Arrange
            SalesService salesService = new SalesService(
                this.operationTableRepository,
                this.balanceTableRepository,
                this.blockedMoneyTableRepository,
                this.sharesNumberTableRepository,
                this.blockedSharesNumberTableRepository);
            var testBalance = new BalanceEntity()
            {
                Id     = 10,
                Amount = 30000.00M,
                Client = new ClientEntity()
                {
                    Id = 10
                },
                Status = true
            };
            decimal newAmount = 35000.00M;

            // Act
            bool flag = salesService.ChangeBalance(testBalance, newAmount);

            // Assert
            this.balanceTableRepository.Received(1).ChangeAmount(testBalance.Id, newAmount);
            this.balanceTableRepository.Received(1).SaveChanges();
            if (!flag)
            {
                throw new ArgumentException("The flag is false");
            }
        }