示例#1
0
        public async Task Get_Balance_By_UserId_ReturnBalance()
        {
            var expected = new Balance()
            {
                Id = 1, TotalBalance = 299
            };
            var balance = GetFakeBalance(1, 299, 1);

            _balanceRepository.Setup(x => x.GetByIdAsync(It.IsAny <int>())).Returns(Task.FromResult(balance));

            _balanceService = new BalanceService(_balanceRepository.Object, _expenseRecordRepository.Object);
            var actual = await _balanceService.GetBalanceById(expected.Id);

            Assert.Equal(expected.Id, actual.Id);
            Assert.Equal(expected.TotalBalance, actual.TotalBalance);
        }