public void QueryFormatUnlessParameterCountNotLimitedTo2098WhenConditionIsMet()
 {
     Assert.Throws <ArgumentException>(() => TSql.QueryStatementFormatUnless(false, "", ParameterCountLimitedExceeded.Instance.All).ToArray());
 }
Exemplo n.º 2
0
        private static IEnumerable <TestCaseData> QueryStatementFormatUnlessCases()
        {
            yield return(new TestCaseData(
                             TSql.QueryStatementFormatUnless(false, "text"),
                             new[] { new SqlQueryCommand("text", new DbParameter[0], CommandType.Text) }));

            yield return(new TestCaseData(
                             TSql.QueryStatementFormatUnless(false, "text", parameters: null),
                             new[] { new SqlQueryCommand("text", new DbParameter[0], CommandType.Text) }));

            yield return(new TestCaseData(
                             TSql.QueryStatementFormatUnless(false, "text", new IDbParameterValue[0]),
                             new[] { new SqlQueryCommand("text", new DbParameter[0], CommandType.Text) }));

            yield return(new TestCaseData(
                             TSql.QueryStatementFormatUnless(false, "text", new SqlParameterValueStub()),
                             new[]
            {
                new SqlQueryCommand("text", new[]
                {
                    new SqlParameterValueStub().ToDbParameter("@P0")
                }, CommandType.Text)
            }));

            yield return(new TestCaseData(
                             TSql.QueryStatementFormatUnless(false, "text {0}", new SqlParameterValueStub()),
                             new[]
            {
                new SqlQueryCommand("text @P0", new[]
                {
                    new SqlParameterValueStub().ToDbParameter("@P0")
                }, CommandType.Text)
            }));

            yield return(new TestCaseData(
                             TSql.QueryStatementFormatUnless(false, "text", new SqlParameterValueStub(), new SqlParameterValueStub()),
                             new[]
            {
                new SqlQueryCommand("text", new[]
                {
                    new SqlParameterValueStub().ToDbParameter("@P0"),
                    new SqlParameterValueStub().ToDbParameter("@P1")
                }, CommandType.Text)
            }));

            yield return(new TestCaseData(
                             TSql.QueryStatementFormatUnless(false, "text {0} {1}", new SqlParameterValueStub(), new SqlParameterValueStub()),
                             new[]
            {
                new SqlQueryCommand("text @P0 @P1", new[]
                {
                    new SqlParameterValueStub().ToDbParameter("@P0"),
                    new SqlParameterValueStub().ToDbParameter("@P1")
                }, CommandType.Text)
            }));

            yield return(new TestCaseData(
                             TSql.QueryStatementFormatUnless(true, "text"),
                             new SqlQueryCommand[0]));

            yield return(new TestCaseData(
                             TSql.QueryStatementFormatUnless(true, "text", parameters: null),
                             new SqlQueryCommand[0]));

            yield return(new TestCaseData(
                             TSql.QueryStatementFormatUnless(true, "text", new IDbParameterValue[0]),
                             new SqlQueryCommand[0]));

            yield return(new TestCaseData(
                             TSql.QueryStatementFormatUnless(true, "text", new SqlParameterValueStub()),
                             new SqlQueryCommand[0]));

            yield return(new TestCaseData(
                             TSql.QueryStatementFormatUnless(true, "text {0}", new SqlParameterValueStub()),
                             new SqlQueryCommand[0]));

            yield return(new TestCaseData(
                             TSql.QueryStatementFormatUnless(true, "text", new SqlParameterValueStub(), new SqlParameterValueStub()),
                             new SqlQueryCommand[0]));

            yield return(new TestCaseData(
                             TSql.QueryStatementFormatUnless(true, "text {0} {1}", new SqlParameterValueStub(), new SqlParameterValueStub()),
                             new SqlQueryCommand[0]));
        }
 public void QueryFormatUnlessParameterCountLimitedTo2098WhenConditionIsMet()
 {
     Assert.DoesNotThrow(() => TSql.QueryStatementFormatUnless(true, "", ParameterCountLimitedExceeded.Instance.All).ToArray());
 }