public async Task Reject(int borrowId) { Borrow borrowDomain = await GetBorrowAsync(borrowId); borrowDomain.Reject(); await this._borrowRepository.Save(borrowDomain); }
public async Task GivenBorrowServiceWhenConfirmWithBorrowFoundAndRejectedThenStatusInvalidException() { Borrow borrowDomain = FakeBuilder.GetBorrowFake(); borrowDomain.Reject(); Assert.True(borrowDomain.Status == BorrowStatus.Rejected); this._mockBorrowRepository.Setup(repo => repo.Get(It.IsAny <int>())) .ReturnsAsync(borrowDomain); await Assert.ThrowsAsync <StatusInvalidException>(() => this._borrowService.Confirm(borrowDomain.BorrowId)); this._mockBorrowRepository.Verify(mock => mock.Save(It.IsAny <Borrow>()), Times.Never); }