Exemplo n.º 1
0
        public void NotEndedStatementsShouldNotBeAddedToScript1()
        {
            var q = new SharpQuery();

            q.Select(1);
            TSqlAssert.ScriptsAreEqual(string.Empty, q.ToString());
        }
Exemplo n.º 2
0
        public void EndedStatementsShouldBeAddedToScript()
        {
            var q = new SharpQuery();

            q.Select(1).EndStatement();
            var script = q.ToString();

            TSqlAssert.ScriptsAreEqual(script, "SELECT @p0");
        }
Exemplo n.º 3
0
        public void QueryAlwaysGeneratesTheSameScript()
        {
            var q = new SharpQuery();
            var u = new UserTable();
            var p = new PostTable();

            q.Select(u.FirstName, u.Email, p.Title).From(u).LeftOuterJoin(p, p.UserId.IsEqualTo(u.Id)).EndStatement();

            var script1 = q.ToString();
            var script2 = q.ToString();

            TSqlAssert.ScriptsAreEqual(script1, script2);
        }
Exemplo n.º 4
0
        public void EmptyQueryReturnsEmptyScript()
        {
            var q = new SharpQuery();

            TSqlAssert.ScriptsAreEqual(string.Empty, q.ToString());
        }