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

            copier.PowerOn();

            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);
        }
        public void Copier_GetState_StateOn()
        {
            var copier = new Copier();

            copier.PowerOn();

            Assert.AreEqual(IDevice.State.on, copier.GetState());
        }
Exemplo n.º 3
0
        public void MultidimensionalDevice_GetState_StateOn()
        {
            var copier = new Copier();

            copier.PowerOn();

            Assert.AreEqual(IDevice.State.on, copier.GetState());
        }
        public void Copier_GetState_StateOn()
        {
            var p      = new Printer();
            var s      = new Scanner();
            var copier = new Copier(p, s);

            copier.PowerOn();

            Assert.AreEqual(IDevice.State.on, copier.GetState());
        }
        public void Copier_PowerOnCounter()
        {
            var p      = new Printer();
            var s      = new Scanner();
            var copier = new Copier(p, s);

            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(out doc1);
            copier.ScanAndPrint(out doc2);

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

            copier.PowerOn();

            var currentConsoleOut = Console.Out;

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

            copier.PowerOn();

            var currentConsoleOut = Console.Out;

            currentConsoleOut.Flush();
            using (var consoleOutput = new ConsoleRedirectionToStringWriter()) {
                copier.ScanAndPrint();
                Assert.IsTrue(consoleOutput.GetOutput().Contains("Scan"));
                Assert.IsTrue(consoleOutput.GetOutput().Contains("Print"));
            }
            Assert.AreEqual(currentConsoleOut, Console.Out);
        }
Exemplo n.º 8
0
        public void MultidimensionalDevice_Scan_DeviceOn_ScannerOff()
        {
            var copier = new Copier();

            copier.PowerOn();

            var currentConsoleOut = Console.Out;

            currentConsoleOut.Flush();
            using (var consoleOutput = new ConsoleRedirectionToStringWriter())
            {
                IDocument doc1;
                copier.Scan(out doc1);
                Assert.IsFalse(consoleOutput.GetOutput().Contains("Scan"));
            }
            Assert.AreEqual(currentConsoleOut, Console.Out);
        }
Exemplo n.º 9
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);
        }
        public void Copier_Scan_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 doc1;
                copier.Scan(out doc1);
                Assert.IsTrue(consoleOutput.GetOutput().Contains("Scan"));
            }
            Assert.AreEqual(currentConsoleOut, Console.Out);
        }
Exemplo n.º 11
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);
        }
        static void Main(string[] args)
        {
            Copier copier = new Copier();

            Console.WriteLine($"Current copier state: {copier.GetState()}");
            copier.PowerOn();
            Console.WriteLine($"Current copier state: {copier.GetState()}");
            var doc = new PDFDocument("doc.pdf");

            copier._Printer.Print(doc);
            copier._Printer.Print(doc);
            copier._Printer.Print(doc);
            //cooling down after 3 prints
            copier._Printer.Print(doc);
            copier._Scanner.Scan();
            copier._Scanner.Scan();
            //cooling down after 2 scans
            copier._Scanner.Scan();
            copier.GetCounter();
            Console.WriteLine($"Current copier state: {copier.GetState()}");
            copier.PowerOff();
            Console.WriteLine($"Current copier state: {copier.GetState()}");
        }