public void NonQueryProcedureFormatIfParameterCountNotLimitedTo2098WhenConditionIsNotMet()
 {
     Assert.DoesNotThrow(() => TSql.NonQueryProcedureFormatIf(false, "", ParameterCountLimitedExceeded.Instance.All).ToArray());
 }
        private static IEnumerable <TestCaseData> NonQueryProcedureFormatIfCases()
        {
            yield return(new TestCaseData(
                             TSql.NonQueryProcedureFormatIf(true, "text"),
                             new[] { new SqlNonQueryCommand("text", new DbParameter[0], CommandType.StoredProcedure) }));

            yield return(new TestCaseData(
                             TSql.NonQueryProcedureFormatIf(true, "text", parameters: null),
                             new[] { new SqlNonQueryCommand("text", new DbParameter[0], CommandType.StoredProcedure) }));

            yield return(new TestCaseData(
                             TSql.NonQueryProcedureFormatIf(true, "text", new IDbParameterValue[0]),
                             new[] { new SqlNonQueryCommand("text", new DbParameter[0], CommandType.StoredProcedure) }));

            yield return(new TestCaseData(
                             TSql.NonQueryProcedureFormatIf(true, "text", new SqlParameterValueStub()),
                             new[]
            {
                new SqlNonQueryCommand("text", new[]
                {
                    new SqlParameterValueStub().ToDbParameter("@P0")
                }, CommandType.StoredProcedure)
            }));

            yield return(new TestCaseData(
                             TSql.NonQueryProcedureFormatIf(true, "text {0}", new SqlParameterValueStub()),
                             new[]
            {
                new SqlNonQueryCommand("text @P0", new[]
                {
                    new SqlParameterValueStub().ToDbParameter("@P0")
                }, CommandType.StoredProcedure)
            }));

            yield return(new TestCaseData(
                             TSql.NonQueryProcedureFormatIf(true, "text", new SqlParameterValueStub(), new SqlParameterValueStub()),
                             new[]
            {
                new SqlNonQueryCommand("text", new[]
                {
                    new SqlParameterValueStub().ToDbParameter("@P0"),
                    new SqlParameterValueStub().ToDbParameter("@P1")
                }, CommandType.StoredProcedure)
            }));

            yield return(new TestCaseData(
                             TSql.NonQueryProcedureFormatIf(true, "text {0} {1}", new SqlParameterValueStub(), new SqlParameterValueStub()),
                             new[]
            {
                new SqlNonQueryCommand("text @P0 @P1", new[]
                {
                    new SqlParameterValueStub().ToDbParameter("@P0"),
                    new SqlParameterValueStub().ToDbParameter("@P1")
                }, CommandType.StoredProcedure)
            }));

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

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

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

            yield return(new TestCaseData(
                             TSql.NonQueryProcedureFormatIf(false, "text", new SqlParameterValueStub()),
                             new SqlNonQueryCommand[0]));

            yield return(new TestCaseData(
                             TSql.NonQueryProcedureFormatIf(false, "text {0}", new SqlParameterValueStub()),
                             new SqlNonQueryCommand[0]));

            yield return(new TestCaseData(
                             TSql.NonQueryProcedureFormatIf(false, "text", new SqlParameterValueStub(), new SqlParameterValueStub()),
                             new SqlNonQueryCommand[0]));

            yield return(new TestCaseData(
                             TSql.NonQueryProcedureFormatIf(false, "text {0} {1}", new SqlParameterValueStub(), new SqlParameterValueStub()),
                             new SqlNonQueryCommand[0]));
        }
 public void NonQueryProcedureFormatIfParameterCountLimitedTo2098WhenConditionIsMet()
 {
     Assert.Throws <ArgumentException>(() => TSql.NonQueryProcedureFormatIf(true, "", ParameterCountLimitedExceeded.Instance.All).ToArray());
 }