public void Copier_ScanCounter()
        {
            var copier = new Copier();

            copier.PowerOn();

            IDocument doc1;

            copier.Scan(out doc1);
            IDocument doc2;

            copier.Scan(out doc2);

            IDocument doc3 = new ImageDocument("aaa.jpg");

            copier.Print(in doc3);

            copier.PowerOff();
            copier.Print(in doc3);
            copier.Scan(out doc1);
            copier.PowerOn();

            copier.ScanAndPrint();
            copier.ScanAndPrint();

            // 4 skany, gdy urządzenie włączone
            Assert.AreEqual(4, copier.ScanCounter);
        }
        public void Copier_PowerOnCounter()
        {
            var copier = new Copier();

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

            IDocument doc1;

            copier.Scan(out doc1);
            IDocument doc2;

            copier.Scan(out doc2);

            copier.PowerOff();
            copier.PowerOff();
            copier.PowerOff();
            copier.PowerOn();

            IDocument doc3 = new ImageDocument("aaa.jpg");

            copier.Print(in doc3);

            copier.PowerOff();
            copier.Print(in doc3);
            copier.Scan(out doc1);
            copier.PowerOn();

            copier.ScanAndPrint();
            copier.ScanAndPrint();

            // 3 włączenia
            Assert.AreEqual(3, copier.Counter);
        }
Exemplo n.º 3
0
            public void Copier_ScanCounter()
            {
                var copier = new Copier();

                copier.scanner.PowerOn();

                IDocument doc1;

                copier.scanner.Scan(out doc1);
                IDocument doc2;

                copier.scanner.Scan(out doc2);

                IDocument doc3 = new ImageDocument("aaa.jpg");

                copier.printer.Print(in doc3);

                copier.scanner.PowerOff();
                copier.printer.Print(in doc3);
                copier.scanner.Scan(out doc1);
                copier.printer.PowerOn();

                copier.scanner.PowerOn();

                copier.ScanAndPrint();
                copier.ScanAndPrint();

                Assert.AreEqual(4, copier.scanner.ScanCounter);
            }
        public void Copier_PrintCounter()
        {
            var copier = new Copier();

            copier.PowerOn();

            IDocument doc1 = new PDFDocument("aaa.pdf");

            copier.Print(in doc1);
            IDocument doc2 = new TextDocument("aaa.txt");

            copier.Print(in doc2);
            IDocument doc3 = new ImageDocument("aaa.jpg");

            copier.Print(in doc3);

            copier.PowerOff();
            copier.Print(in doc3);
            copier.Scan(out doc1);
            copier.PowerOn();

            copier.ScanAndPrint();
            copier.ScanAndPrint();

            // 5 wydruków, gdy urządzenie włączone
            Assert.AreEqual(5, copier.PrintCounter);
        }
Exemplo n.º 5
0
        public void Copier_PowerOnCounter()
        {
            var copier = new Copier();

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

            IDocument doc1;

            copier.Scan(IDocument.FormatType.JPG);
            IDocument doc2;

            copier.Scan(IDocument.FormatType.PDF);

            copier.PowerOff();
            copier.PowerOff();
            copier.PowerOff();
            copier.PowerOn();

            IDocument doc3 = new ImageDocument("aaa.jpg");

            copier.Print(doc3);

            copier.PowerOff();
            copier.Print(doc3);
            copier.Scan(IDocument.FormatType.PDF);
            copier.PowerOn();

            copier.ScanAndPrint(IDocument.FormatType.TXT);
            copier.ScanAndPrint(IDocument.FormatType.JPG);

            // 3 w³¹czenia
            Assert.AreEqual(3, copier.Counter);
        }
Exemplo n.º 6
0
            public void Copier_PrintCounter()
            {
                var copier = new Copier();

                copier.printer.PowerOn();

                IDocument doc1 = new PDFDocument("aaa.pdf");

                copier.printer.Print(in doc1);
                IDocument doc2 = new TextDocument("aaa.txt");

                copier.printer.Print(in doc2);
                IDocument doc3 = new ImageDocument("aaa.jpg");

                copier.printer.Print(in doc3);

                copier.printer.PowerOff();
                copier.printer.Print(in doc3);
                copier.scanner.Scan(out doc1);
                copier.scanner.PowerOn();

                copier.ScanAndPrint();
                copier.ScanAndPrint();

                Assert.AreEqual(3, copier.printer.PrintCounter);
            }
Exemplo n.º 7
0
        public void Copier_ScanCounter()
        {
            var copier = new Copier();

            copier.PowerOn();

            IDocument doc1;

            copier.Scan(IDocument.FormatType.PDF);
            IDocument doc2;

            copier.Scan(IDocument.FormatType.JPG);

            IDocument doc3 = new ImageDocument("aaa.jpg");

            copier.Print(doc3);

            copier.PowerOff();
            copier.Print(doc3);
            copier.Scan(IDocument.FormatType.PDF);
            copier.PowerOn();

            copier.ScanAndPrint(IDocument.FormatType.TXT);
            copier.ScanAndPrint(IDocument.FormatType.PDF);

            // 4 skany, gdy urz¹dzenie w³¹czone
            Assert.AreEqual(4, copier.ScanCounter);
        }
Exemplo n.º 8
0
        public void Copier_PrintCounter()
        {
            var copier = new Copier();

            copier.PowerOn();

            IDocument doc1 = new PDFDocument("aaa.pdf");

            copier.Print(doc1);
            IDocument doc2 = new TextDocument("aaa.txt");

            copier.Print(doc2);
            IDocument doc3 = new ImageDocument("aaa.jpg");

            copier.Print(doc3);

            copier.PowerOff();
            copier.Print(doc3);
            copier.Scan(IDocument.FormatType.PDF);
            copier.PowerOn();

            copier.ScanAndPrint(IDocument.FormatType.JPG);
            copier.ScanAndPrint(IDocument.FormatType.TXT);

            // 5 wydruków, gdy urz¹dzenie w³¹czone
            Assert.AreEqual(5, copier.PrintCounter);
        }
Exemplo n.º 9
0
        public void Copier_ScanAndPrint_DeviceOff()
        {
            var copier = new Copier();

            copier.PowerOff();

            var currentConsoleOut = Console.Out;

            currentConsoleOut.Flush();
            using (var consoleOutput = new ConsoleRedirectionToStringWriter()) {
                copier.ScanAndPrint();
                Assert.IsFalse(consoleOutput.GetOutput().Contains("Scan"));
                Assert.IsFalse(consoleOutput.GetOutput().Contains("Print"));
            }
            Assert.AreEqual(currentConsoleOut, Console.Out);
        }
Exemplo n.º 10
0
        static void Main()
        {
            var xerox = new Copier();

            xerox.PowerOn();
            IDocument doc1 = new PDFDocument("aaa.pdf");

            xerox.Print(in doc1);

            IDocument doc2;

            xerox.Scan(out doc2);

            xerox.ScanAndPrint();
            System.Console.WriteLine(xerox.Counter);
            System.Console.WriteLine(xerox.PrintCounter);
            System.Console.WriteLine(xerox.ScanCounter);
        }
Exemplo n.º 11
0
        public void MultidimensionalDevice_ScanAndPrint_DeviceOn_PrinterOff_ScannerOn()
        {
            var copier = new Copier();

            copier.PowerOn();
            copier.TurnScannerOn();

            var currentConsoleOut = Console.Out;

            currentConsoleOut.Flush();
            using (var consoleOutput = new ConsoleRedirectionToStringWriter())
            {
                copier.ScanAndPrint();
                Assert.IsTrue(consoleOutput.GetOutput().Contains("Scan"));
                Assert.IsFalse(consoleOutput.GetOutput().Contains("Print"));
            }
            Assert.AreEqual(currentConsoleOut, Console.Out);
        }
        public void Copier_ScanAndPrint_DeviceOn()
        {
            var p      = new Printer();
            var s      = new Scanner();
            var copier = new Copier(p, s);

            copier.PowerOn();

            var currentConsoleOut = Console.Out;

            currentConsoleOut.Flush();
            using (var consoleOutput = new ConsoleRedirectionToStringWriter())
            {
                IDocument doc;
                copier.ScanAndPrint(out doc);
                Assert.IsTrue(consoleOutput.GetOutput().Contains("Scan"));
                Assert.IsTrue(consoleOutput.GetOutput().Contains("Print"));
            }
            Assert.AreEqual(currentConsoleOut, Console.Out);
        }
Exemplo n.º 13
0
        static void Main(string[] args)
        {
            var xerox = new Copier();

            xerox.PowerOn();
            IDocument doc1 = new PDFDocument("aaa.pdf");

            xerox.Print(in doc1);

            IDocument doc2;

            xerox.Scan(out doc2);

            xerox.ScanAndPrint();

            MultiFunctionalDevice device = new MultiFunctionalDevice();

            device.PowerOn();

            IDocument doc3;

            device.Fax(out doc3);
            device.ScanAndPrint();
            IDocument doc4;

            device.Scan(out doc4);
            IDocument doc5 = new PDFDocument("bbb.pdf");

            device.Print(doc5);

            IDocument document = new ImageDocument("image.jpg");

            device.Fax(out document);

            Console.WriteLine(xerox.Counter);
            Console.WriteLine(xerox.PrintCounter);
            Console.WriteLine(xerox.ScanCounter);
        }