public void MultidimensionalDevice_PowerOnCounter() { var fax = new MultidimensionalDevice(); fax.PowerOn(); fax.PowerOn(); fax.PowerOn(); IDocument doc1; fax.Scan(IDocument.FormatType.TXT); IDocument doc2; fax.Scan(IDocument.FormatType.TXT); fax.PowerOff(); fax.PowerOff(); fax.PowerOff(); fax.PowerOn(); IDocument doc3 = new ImageDocument("aaa.jpg"); fax.Print(doc3); fax.PowerOff(); fax.Print(doc3); fax.Scan(IDocument.FormatType.TXT); fax.PowerOn(); fax.ScanAndPrint(IDocument.FormatType.TXT); fax.ScanAndPrint(IDocument.FormatType.TXT); // 3 w³¹czenia Assert.AreEqual(3, fax.Counter); }
public void MultidimensionalDevice_PrintCounter() { var fax = new MultidimensionalDevice(); fax.PowerOn(); IDocument doc1 = new PDFDocument("aaa.pdf"); fax.Print(doc1); IDocument doc2 = new TextDocument("aaa.txt"); fax.Print(doc2); IDocument doc3 = new ImageDocument("aaa.jpg"); fax.Print(doc3); fax.PowerOff(); fax.Print(doc3); fax.Scan(IDocument.FormatType.JPG); fax.PowerOn(); fax.ScanAndPrint(IDocument.FormatType.TXT); fax.ScanAndPrint(IDocument.FormatType.TXT); // 5 wydruków, gdy urz¹dzenie w³¹czone Assert.AreEqual(5, fax.PrintCounter); }
public void MultidimensionalDevice_ScanCounter() { var fax = new MultidimensionalDevice(); fax.PowerOn(); IDocument doc1; fax.Scan(IDocument.FormatType.TXT); IDocument doc2; fax.Scan(IDocument.FormatType.TXT); IDocument doc3 = new ImageDocument("aaa.jpg"); fax.Print(doc3); fax.PowerOff(); fax.Print(doc3); fax.Scan(IDocument.FormatType.TXT); fax.PowerOn(); fax.ScanAndPrint(IDocument.FormatType.TXT); fax.ScanAndPrint(IDocument.FormatType.TXT); // 4 skany, gdy urz¹dzenie w³¹czone Assert.AreEqual(4, fax.ScanCounter); }
public void MultidimensionalDevice_Print_DeviceOff() { var fax = new MultidimensionalDevice(); fax.PowerOff(); var currentConsoleOut = Console.Out; currentConsoleOut.Flush(); using (var consoleOutput = new ConsoleRedirectionToStringWriter()) { IDocument doc1 = new PDFDocument("aaa.pdf"); fax.Print(doc1); Assert.IsFalse(consoleOutput.GetOutput().Contains("Print")); } Assert.AreEqual(currentConsoleOut, Console.Out); }