Hello all, I'm trying to get my head around the idea of testing functionality and minimizing the number of asserts.
So lets say I have such a service method:
public void TransferFunds(int debitedId, int creditedId, Sum funds)
{
Account debited = accountRepository.Get(debitedId);
Account credited = accountRepository.Get(creditedId);
debited.Debit(Sum);
credited.Credit(Sum);
accountRepository.Update(debited);
accountRepository.Update(credited);
}
My unit tests I presume should then split into two, testing the crediting of one account and the debiting of the other. But should I assert on each account current state, to verify the sum has been added/deducted- or is this a test for my Account model? If so, what should I assert? that update was called? That doesn't verify the functionality...
Anyone has an idea?