示例#1
0
        public void BeginDrawTest()
        {
            StringWriter stringWriter       = new StringWriter();
            StringWriter resultStringWriter = new StringWriter();

            using (var adapterOne = new MGREndererClassAdapter(stringWriter))
            {
                adapterOne.BeginDraw();
            }
            resultStringWriter.WriteLine("<draw>");
            resultStringWriter.WriteLine("</draw>");
            Assert.AreEqual(resultStringWriter.ToString(), stringWriter.ToString());
            var adapterTwo = new MGREndererClassAdapter(stringWriter);

            adapterTwo.BeginDraw();
            Assert.ThrowsException <Exception>(() => adapterTwo.BeginDraw());
        }
示例#2
0
        public void MoveToTest()
        {
            StringWriter stringWriter       = new StringWriter();
            StringWriter resultStringWriter = new StringWriter();

            using (var adapter = new MGREndererClassAdapter(stringWriter))
            {
                adapter.BeginDraw();
                adapter.MoveTo(12, 19);
            }
            resultStringWriter.WriteLine("<draw>");
            resultStringWriter.WriteLine("</draw>");
            Assert.AreEqual(resultStringWriter.ToString(), stringWriter.ToString());
        }
示例#3
0
        public void LineToWithDefaultColorTest()
        {
            StringWriter stringWriter       = new StringWriter();
            StringWriter resultStringWriter = new StringWriter();

            using (var adapter = new MGREndererClassAdapter(stringWriter))
            {
                adapter.BeginDraw();
                adapter.MoveTo(5, 5);
                adapter.LineTo(10, 10);
            }
            resultStringWriter.WriteLine("<draw>");
            resultStringWriter.WriteLine("<line fromX=5 fromY=5 toX=10 toY=10>");
            resultStringWriter.WriteLine("  <color r=\"0\" g=\"0\" b=\"0\" a=\"0\" />");
            resultStringWriter.WriteLine("</line>");
            resultStringWriter.WriteLine("</draw>");
            Assert.AreEqual(resultStringWriter.ToString(), stringWriter.ToString());
        }