예제 #1
0
            public void The_sql_builder_should_return_a_concatenated_sql_string()
            {
                var inputSql1 = "input1";
                var inputSql2 = "input2";
                var sqlBuilder = new SqlBuilder();
                sqlBuilder.Add( inputSql1 );
                sqlBuilder.Add( inputSql2 );

                var expectedSql = inputSql1 + inputSql2;
                var resultSql = sqlBuilder.GetSql();

                Assert.AreEqual( expectedSql, resultSql );
            }
예제 #2
0
            public void The_sql_builder_should_return_a_sql_string_equal_to_the_input()
            {
                var inputSql = "input";
                var sqlBuilder = new SqlBuilder();
                sqlBuilder.Add( inputSql );
                var resultSql = sqlBuilder.GetSql();

                Assert.AreEqual( inputSql, resultSql );
            }
예제 #3
0
            public void The_sql_builder_should_return_a_concatenated_string_with_the_placeholder_replaced_with_the_parameter_name()
            {
                var inputSql1 = "input1 {0}";
                var inputSql2 = "input2";
                var parameterName = "parameter";
                var expectedSql = "input1 parameterinput2";

                var sqlBuilder = new SqlBuilder();
                sqlBuilder.Add( inputSql1, parameterName );
                sqlBuilder.Add( inputSql2 );

                var resultSql = sqlBuilder.GetSql();
                Assert.AreEqual( expectedSql, resultSql );
            }
예제 #4
0
            public void The_sql_builder_should_return_a_string_with_the_placeholders_replaced_in_order_with_the_parameter_names()
            {
                var inputSql = "input1 {0} ";
                var inputSql2 = "{0} input2";
                var parameterName1 = "param1";
                var parameterName2 = "param2";
                var expectedSql = "input1 param1 param2 input2";
                var sqlBuilder = new SqlBuilder();
                sqlBuilder.Add( inputSql, parameterName1 );
                sqlBuilder.Add( inputSql2, parameterName2 );

                var resultSql = sqlBuilder.GetSql();
                Assert.AreEqual( expectedSql, resultSql );
            }