public void BillOfExchangeCheckTest_Correct() { // arrange BillOfExchangeCheckFixture billOfExchangeCheckFixture = new BillOfExchangeCheckFixture().CreateBillOfExchange(1, 2); var billOfExchangeChecker = new BillOfExchangeChecker(); // act BillOfExchangeCheckResult result = billOfExchangeChecker.BillOfExchangeCheck(billOfExchangeCheckFixture.BillOfExchange); // assert Assert.IsTrue(result.IsCorrect); }
public void BillOfExchangeCheckTest_SameParties() { // arrange int sameId = 1; BillOfExchangeCheckFixture billOfExchangeCheckFixture = new BillOfExchangeCheckFixture().CreateBillOfExchange(sameId, sameId); var billOfExchangeChecker = new BillOfExchangeChecker(); // act BillOfExchangeCheckResult result = billOfExchangeChecker.BillOfExchangeCheck(billOfExchangeCheckFixture.BillOfExchange); // assert Assert.IsFalse(result.IsCorrect); }
public BillOfExchangeDetailDto GetBillOfExchange(int billId) { BillOfExchange bill = BillOfExchangeRepository.GetByIds(new List <int> { billId }).First(); BillOfExchangeCheckResult result = BillOfExchangeChecker.BillOfExchangeCheck(bill); if (!result.IsCorrect) { throw new Exception(result.Message); } Dictionary <int, string> names = GetPartiesDictionary(GetPartiesIds(new List <BillOfExchange> { bill })); return(new BillOfExchangeDetailDto(bill.Id, bill.DrawerId, names[bill.DrawerId], bill.BeneficiaryId, names[bill.BeneficiaryId], bill.Amount)); }