Beispiel #1
0
        public void NotEndedStatementsShouldNotBeAddedToScript1()
        {
            var q = new SharpQuery();

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

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

            TSqlAssert.ScriptsAreEqual(script, "SELECT @p0");
        }
Beispiel #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);
        }
Beispiel #4
0
        public void EmptyQueryReturnsEmptyScript()
        {
            var q = new SharpQuery();

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