示例#1
0
        public void CanWriteFormattedText()
        {
            string expected = "<ul>\n\t<li>\n\t\t1 + 2 = 3\n\t</li>\n</ul>";

            var writer = new SqlWriter();
            writer.AppendLine("<ul>");
                writer.Indent();
                    writer.AppendLine("<li>");
                        writer.Indent();
                            writer.AppendLine("1", "+", "2", "=", "3");
                        writer.Unindent();
                    writer.AppendLine("</li>");
                writer.Unindent();
            writer.AppendLine("</ul>");

            var result = writer.GetResult();
            Assert.AreEqual(expected, result);
        }
示例#2
0
        public void CanRenderSelect()
        {
            var writer = new SqlWriter();
            var convention = new DefaultConvention();
            var builder = new EntityMapBuilder<Student>(convention);

            var map = ((EntityMapBuilder<Student>) builder
                                                       .Key(_ => _.ID, "Student_id")).Build();

            var selectEntity = new Select(map, "t0");

            selectEntity.Render(writer);
            var result = writer.GetResult();

            AssertHelper.AreEqualWithNoSpaces(
            @"SELECT [t0].[Student_id], [t0].[Name]
            FROM [dbo].[Student] AS [t0] (NOLOCK)", result);
        }