Exemplo n.º 1
0
        public void Copier_Scan_FormatTypeDocument()
        {
            var copier = new Copier();

            copier.PowerOn();
            copier.CopierScannerOn();

            var currentConsoleOut = Console.Out;

            currentConsoleOut.Flush();
            using (var consoleOutput = new ConsoleRedirectionToStringWriter())
            {
                IDocument doc1;
                copier.Scan(out doc1, formatType: IDocument.FormatType.JPG);
                Assert.IsTrue(consoleOutput.GetOutput().Contains("Scan"));
                Assert.IsTrue(consoleOutput.GetOutput().Contains(".jpg"));

                copier.Scan(out doc1, formatType: IDocument.FormatType.TXT);
                Assert.IsTrue(consoleOutput.GetOutput().Contains("Scan"));
                Assert.IsTrue(consoleOutput.GetOutput().Contains(".txt"));

                copier.Scan(out doc1, formatType: IDocument.FormatType.PDF);
                Assert.IsTrue(consoleOutput.GetOutput().Contains("Scan"));
                Assert.IsTrue(consoleOutput.GetOutput().Contains(".pdf"));
            }
            Assert.AreEqual(currentConsoleOut, Console.Out);
        }
Exemplo n.º 2
0
        public void Copier_Print_DeviceOn_PrinterOff()
        {
            var copier = new Copier();

            copier.PowerOn();  // Drukarka nie w³¹czona
            var currentConsoleOut = Console.Out;

            currentConsoleOut.Flush();
            using (var consoleOutput = new ConsoleRedirectionToStringWriter())
            {
                IDocument doc1 = new PDFDocument("aaa.pdf");
                copier.Print(in doc1);
                Assert.IsFalse(consoleOutput.GetOutput().Contains("Print"));
            }
            Assert.AreEqual(currentConsoleOut, Console.Out);
        }
Exemplo n.º 3
0
        public void MultidimensionalDevice_Print_DeviceOff()
        {
            var multiFunDev = new MultidimensionalDevice();

            multiFunDev.PowerOff();

            var currentConsoleOut = Console.Out;

            currentConsoleOut.Flush();
            using (var consoleOutput = new ConsoleRedirectionToStringWriter())
            {
                IDocument doc1 = new PDFDocument("aaa.pdf");
                multiFunDev.ScanAndSend(123456789);
                Assert.IsFalse(consoleOutput.GetOutput().Contains("Send"));
            }
            Assert.AreEqual(currentConsoleOut, Console.Out);
        }
Exemplo n.º 4
0
        public void Copier_Scan_DeviceOn_ScannerOn()
        {
            var copier = new Copier();

            copier.PowerOn();
            copier.CopierScannerOn();

            var currentConsoleOut = Console.Out;

            currentConsoleOut.Flush();
            using (var consoleOutput = new ConsoleRedirectionToStringWriter())
            {
                IDocument doc1;
                copier.Scan(out doc1);
                Assert.IsTrue(consoleOutput.GetOutput().Contains("Scan"));
            }
            Assert.AreEqual(currentConsoleOut, Console.Out);
        }