コード例 #1
0
        public void TestCreateCountWitClassMappings()
        {
            // Setup
            var statementBuilder = new SqlDbStatementBuilder();
            var queryBuilder     = new QueryBuilder <TestCreateCountWitClassMappingsClass>();

            // Act
            var actual   = statementBuilder.CreateCount(queryBuilder, null);
            var expected = $"" +
                           $"SELECT COUNT_BIG (1) AS [Counted] " +
                           $"FROM [ClassName] ;";

            // Assert
            Assert.AreEqual(expected, actual);
        }
コード例 #2
0
        public void TestCountWithExpressions()
        {
            // Setup
            var statementBuilder = new SqlDbStatementBuilder();
            var queryBuilder     = new QueryBuilder <TestCreateCountWithExpressionsClass>();
            var expression       = new { Field1 = 1 };

            // Act
            var queryGroup = QueryGroup.Parse(expression);
            var actual     = statementBuilder.CreateCount(queryBuilder, queryGroup);
            var expected   = $"" +
                             $"SELECT COUNT_BIG (1) AS [Counted] " +
                             $"FROM [TestCreateCountWithExpressionsClass] " +
                             $"WHERE ([Field1] = @Field1) ;";

            // Assert
            Assert.AreEqual(expected, actual);
        }