public void TestGenerateBalanceWithInterestWithPositiveTotal() { //Input var previsulyBalance = BalanceFactory.Create(x => { x.Total = -10.00m; x.Charges = new List <ShortEntryDTO>(); }); var balance = BalanceFactory.Create(x => { x.Total = 30.00m; x.Charges = new List <ShortEntryDTO>(); }); var date = DateTime.Now; //behavior _mockBalanceRepository.Setup(m => m.BeginTransaction()) .Verifiable(); _mockBalanceRepository.Setup(m => m.Commit()) .Verifiable(); _mockBalanceRepository.Setup(m => m.Update(balance)) .Verifiable(); _mockBalanceRepository.Setup(m => m.LastByOrDefault(balance.Account, It.IsAny <DateTime>())) .Returns(previsulyBalance); //test _service.GenerateBalanceWithInterest(balance, date); //assert Assert.AreEqual(balance.Closed, true); Assert.AreEqual(balance.Total, 30.00m); _mockBalanceRepository.Verify(x => x.BeginTransaction(), Times.Once()); _mockBalanceRepository.Verify(x => x.Commit(), Times.Once()); _mockBalanceRepository.Verify(x => x.Update(balance), Times.Once()); }