public void NonQueryStatementFormatUnlessParameterCountNotLimitedTo2098WhenConditionIsMet()
 {
     Assert.Throws <ArgumentException>(() => TSql.NonQueryStatementFormatUnless(false, "", ParameterCountLimitedExceeded.Instance.All).ToArray());
 }
Ejemplo n.º 2
0
        private static IEnumerable <TestCaseData> NonQueryStatementFormatUnlessCases()
        {
            yield return(new TestCaseData(
                             TSql.NonQueryStatementFormatUnless(false, "text"),
                             new[] { new SqlNonQueryCommand("text", new DbParameter[0], CommandType.Text) }));

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

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

            yield return(new TestCaseData(
                             TSql.NonQueryStatementFormatUnless(false, "text", new TestDbParameter()),
                             new[]
            {
                new SqlNonQueryCommand("text", new[]
                {
                    new TestDbParameter().ToDbParameter("@P0")
                }, CommandType.Text)
            }));

            yield return(new TestCaseData(
                             TSql.NonQueryStatementFormatUnless(false, "text {0}", new TestDbParameter()),
                             new[]
            {
                new SqlNonQueryCommand("text @P0", new[]
                {
                    new TestDbParameter().ToDbParameter("@P0")
                }, CommandType.Text)
            }));

            yield return(new TestCaseData(
                             TSql.NonQueryStatementFormatUnless(false, "text", new TestDbParameter(), new TestDbParameter()),
                             new[]
            {
                new SqlNonQueryCommand("text", new[]
                {
                    new TestDbParameter().ToDbParameter("@P0"),
                    new TestDbParameter().ToDbParameter("@P1")
                }, CommandType.Text)
            }));

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

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

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

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

            yield return(new TestCaseData(
                             TSql.NonQueryStatementFormatUnless(true, "text", new TestDbParameter()),
                             new SqlNonQueryCommand[0]));

            yield return(new TestCaseData(
                             TSql.NonQueryStatementFormatUnless(true, "text {0}", new TestDbParameter()),
                             new SqlNonQueryCommand[0]));

            yield return(new TestCaseData(
                             TSql.NonQueryStatementFormatUnless(true, "text", new TestDbParameter(), new TestDbParameter()),
                             new SqlNonQueryCommand[0]));

            yield return(new TestCaseData(
                             TSql.NonQueryStatementFormatUnless(true, "text {0} {1}", new TestDbParameter(), new TestDbParameter()),
                             new SqlNonQueryCommand[0]));
        }
 public void NonQueryStatementFormatUnlessParameterCountLimitedTo2098WhenConditionIsMet()
 {
     Assert.DoesNotThrow(() => TSql.NonQueryStatementFormatUnless(true, "", ParameterCountLimitedExceeded.Instance.All).ToArray());
 }