public async Task CashTransfer_NoFee_ExistedSettings_Test() { // arrange var assertCalls = new AssertCalls(); var settings = GetSettingsModel(); var feesClient = InitializeFeesClient(null, settings); var accountsClient = InitializeAccountsClient(); var matchingEngineClient = InitializeMatchingEngineClient(null, AssertMatchingEngineClientInput, assertCalls); var logger = InitializeLogger <CashOperations>(AssertLoggerWarning, assertCalls); var cashOperations = new CashOperations(matchingEngineClient, feesClient, accountsClient, logger); var model = new CashTransferModel(Btc, CashTransferVolume, AccountId, FromWalletId, ToWalletId, Description); // act await cashOperations.CashTransferAsync(BrokerId, model); // assert void AssertMatchingEngineClientInput(CashTransferOperation cashTransferOperation) { AssertCashTransferOperation(cashTransferOperation, CashTransferVolume); AssertFees(cashTransferOperation.Fees, 0); } Assert.Equal(2, assertCalls.Count); }
public async Task CashOut_NoFee_NoSettings_Test() { // arrange var assertCalls = new AssertCalls(); var matchingEngineClient = InitializeMatchingEngineClient(AssertMatchingEngineClientInput, null, assertCalls); var feesClient = InitializeFeesClient(null, null); var accountsClient = InitializeAccountsClient(); var logger = InitializeLogger <CashOperations>(AssertLoggerWarning, assertCalls); var cashOperations = new CashOperations(matchingEngineClient, feesClient, accountsClient, logger); var model = new CashInOutModel(Btc, CashOutNegativeVolume, AccountId, WalletId, Description); // act await cashOperations.CashOutAsync(BrokerId, model); // assert void AssertMatchingEngineClientInput(CashInOutOperation cashInOutOperation) { AssertCashInOutOperation(cashInOutOperation, CashOutNegativeVolume); AssertFees(cashInOutOperation.Fees, 0); } Assert.Equal(2, assertCalls.Count); }
public async Task CashOut_ExistedFee_ExistedSettings_PositiveVolumeToNegative_Test() { // arrange var assertCalls = new AssertCalls(); var feeModel = GetCashOperationsFeeModel(CashOutNegativeVolume, CashType.CashOut); var settings = GetSettingsModel(); var feesClient = InitializeFeesClient(feeModel, settings); var accountsClient = InitializeAccountsClient(); var matchingEngineClient = InitializeMatchingEngineClient(AssertMatchingEngineClientInput, null, assertCalls); var logger = InitializeLogger <CashOperations>(AssertLoggerWarning, assertCalls); var cashOperations = new CashOperations(matchingEngineClient, feesClient, accountsClient, logger); // Volume is positive here and will 'converted' to negative var model = new CashInOutModel(Btc, CashOutPositiveVolume, AccountId, WalletId, Description); // act await cashOperations.CashOutAsync(BrokerId, model); // assert void AssertMatchingEngineClientInput(CashInOutOperation cashInOutOperation) { AssertCashInOutOperation(cashInOutOperation, CashOutNegativeVolume); AssertFees(cashInOutOperation.Fees, CashOutNegativeVolume / 100); } Assert.Equal(1, assertCalls.Count); }
public void PleaseWaitPrintInfo() { PrinterHandler.InitPrinter(true); if (StationRepository.PrinterStatus == 0) { ShowPrinterErrorMessage("info"); return; } long checkpointStart = CashOperations.OrderBy(x => x.CashOutId).Select(x => x.CashOutId).FirstOrDefault(); long checkpointEnd = CashOperations.OrderBy(x => x.CashOutId).Select(x => x.CashOutId).LastOrDefault(); if (checkpointEnd == 0) { checkpointEnd = long.MaxValue; } var end = EndDate; if (end == DateTime.MinValue) { end = DateTime.Now; } Dictionary <Decimal, int> cashinNotes = GetNotesValuesAndCountFromCollection(CashOperations.ToList()); PrinterHandler.PrintCashBalance(cashinNotes, StartDate, end, CashInOperationsNum, CashOutOperationsNum, 0, false, true, "", 0); }
public void PleaseWaitPrintInfo() { PrinterHandler.InitPrinter(true); if (StationRepository.PrinterStatus == 0) { ShowPrinterErrorMessage("info"); return; } var end = EndDate; if (end == DateTime.MinValue) { end = DateTime.Now; } Dictionary <Decimal, int> cashinNotes = GetNotesValuesAndCountFromCollection(CashOperations.ToList()); PrinterHandler.PrintCashBalance(cashinNotes, StartDate, end, CashInOperationsNum, CashOutOperationsNum, 0, false, true, "", 0); }