public async Task Insert_CategoryServiceThrowsServiceException() { _categoryService.Setup(m => m.GetItemAsync(It.IsAny <int>())).Throws <ServiceException>(); var target = new PayingItemServiceTrigger(_categoryService.Object, _accountService.Object); await target.Insert(new PayingItem()); }
public async Task Insert_TypeOfFlowId2_AccountCashDecrease() { var insertedItem = new PayingItem() { Summ = 200 }; var account = new Account() { Cash = 500 }; _categoryService.Setup(m => m.GetItemAsync(It.IsAny <int>())) .ReturnsAsync(new Category { TypeOfFlowID = 2 }); _accountService.Setup(m => m.GetItemAsync(It.IsAny <int>())).ReturnsAsync(account); var target = new PayingItemServiceTrigger(_categoryService.Object, _accountService.Object); await target.Insert(insertedItem); Assert.AreEqual(account.Cash, 300); }