public void print_only_header_when_printing_empty_tx_history() { _statementPrinter.PrintStatement(_txHistory); _console.Verify(c => c.PrintLine("date | credit | debit | balance"), Times.Once); _txRecordPrinter.Verify(txrp => txrp.Print(It.IsAny <TxRecord>()), Times.Never); }
public void VerifyStatementWithNoTransactionsOnlyPrintsHeaderRow() { _statementPrinter.PrintStatement(new Statement(new List <Transaction>())); _console.Received().PrintLine("DATE | AMOUNT | BALANCE"); _console.Received(1).PrintLine(Arg.Any <string>()); }
public void StatementPrinter_WhenTransactionIsEmpty_ReturnsHeader() { // Arrange var expectedOutput = "Date || Amount || Balance".Replace(" ", ""); // Act sut.PrintStatement(new List <Transaction>()); // Assert consoleMock.Verify(console => console.WriteLine( It.Is <string>(s => s.Replace(" ", "") == expectedOutput)), Times.Once); }
private bool ProcessStatementPrint(long statementId, long?printerId) { bool HasPrinted; if (!printerId.HasValue) { return(false); } using (var uow = new DevExpress.Xpo.UnitOfWork()) { XDB.GLX_Statement statement = uow.Query <XDB.GLX_Statement>().SingleOrDefault(n => n.Id == statementId); XDB.SYS_Printer printer = uow.Query <XDB.SYS_Printer>().SingleOrDefault(n => n.Id == printerId.Value); try { var account = uow.Query <XDB.GLX_Account>().Where(n => n.EntityId.Id == statement.EntityId.Id).Select(l => new { l.EntityId.CodeMain, l.EntityId.CodeSub }).FirstOrDefault(); if (account.CodeMain == BL.ApplicationDataContext.Instance.SiteAccounts.DebtorsEntity.CodeMain) { StatementPrinter sp = new StatementPrinter(); sp.PrintStatement(printer.Location, printer.PrinterModel, StatementCustomerPrintTemplate.OuterXml, statement.EntityId.Id, statement.PeriodId.Id, ConfigurationManager.ConnectionStrings["BaseConnection"].ConnectionString); //sp = new StatementPrinter(); //if (!System.IO.Directory.Exists(System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\Statements")) // System.IO.Directory.CreateDirectory(System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\Statements"); // //sp.PrintStatementToFile(string.Format(@"{0}\STATEMENT_{1}.txt", System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\Statements", statement.EntityId.Id), printer.PrinterModel, StatementCustomerPrintTemplate.OuterXml, statement.EntityId.Id, statement.PeriodId.Id, ConfigurationManager.ConnectionStrings["BaseConnection"].ConnectionString); } else if (account.CodeMain == BL.ApplicationDataContext.Instance.SiteAccounts.CreditorsEntity.CodeMain) { StatementPrinter sp = new StatementPrinter(); sp.PrintStatement(printer.Location, printer.PrinterModel, StatementSupplierPrintTemplate.OuterXml, statement.EntityId.Id, statement.PeriodId.Id, ConfigurationManager.ConnectionStrings["BaseConnection"].ConnectionString); //sp = new StatementPrinter(); //if (!System.IO.Directory.Exists(System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\Statements")) // System.IO.Directory.CreateDirectory(System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\Statements"); // //sp.PrintStatementToFile(string.Format(@"{0}\STATEMENT_{1}.txt", System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\Statements", statement.EntityId.Id), printer.PrinterModel, StatementSupplierPrintTemplate.OuterXml, statement.EntityId.Id, statement.PeriodId.Id, ConfigurationManager.ConnectionStrings["BaseConnection"].ConnectionString); } statement.HasPrinted = HasPrinted = true; } catch { statement.HasPrinted = HasPrinted = false; } uow.CommitChanges(); } return(HasPrinted); }
public void ShouldPrintAStatementWithAHeader() { _printer.PrintStatement(new ReadOnlyCollection <Transaction>(new List <Transaction>())); _mockConsole.Verify(c => c.Print(StatementHeader), Times.Once); }
public void PrintHeaderRow() { _statementPrinter.PrintStatement(new List <Transaction>()); _console.Received().PrintLine("DATE | AMOUNT | BALANCE"); }