예제 #1
0
        public void RenderOneRowGivenStubDataAdapter()
        {
            var myRenderer = new DataRenderer(new StubDbAdapter());
            var writer     = new StringWriter();

            myRenderer.Render(writer);
            string result = writer.ToString();

            Console.Write(result);

            int lineCount = result.Count(c => c == '\n');

            Assert.AreEqual(3, lineCount);
        }
        public void RenderTwoRowsGivenOleDbDataAdapter()
        {
            var adapter = new OleDbDataAdapter();

            adapter.SelectCommand            = new OleDbCommand("SELECT * FROM Pattern");
            adapter.SelectCommand.Connection =
                new OleDbConnection(
                    @"Provider=Microsoft.SQLSERVER.CE.OLEDB.3.5;Data Source=C:\git\learning\deleteme2\AdapterDemo\AdapterDemo\Sample.sdf");
            var myRenderer = new DataRenderer(adapter);

            var writer = new StringWriter();

            myRenderer.Render(writer);

            string result = writer.ToString();

            Console.Write(result);

            int lineCount = result.Count(c => c == '\n');

            Assert.AreEqual(4, lineCount);
        }
예제 #3
0
        public void RenderTwoRowsGivenOleDbDataAdapter()
        {
            var adapter = new OleDbDataAdapter();

            adapter.SelectCommand            = new OleDbCommand("SELECT * FROM Pattern");
            adapter.SelectCommand.Connection =
                new OleDbConnection(
                    @"Provider=Microsoft.SQLSERVER.CE.OLEDB.3.5;Data Source=C:\Users\Steve\Documents\My Dropbox\PluralsightCurrent\009 - Adapter Pattern\AdapterDemo\AdapterDemo\Sample.sdf");
            var myRenderer = new DataRenderer(adapter);

            var writer = new StringWriter();

            myRenderer.Render(writer);

            string result = writer.ToString();

            Console.Write(result);

            int lineCount = result.Count(c => c == '\n');

            Assert.AreEqual(4, lineCount);
        }