private static IEnumerable <TestCaseData> NonQueryProcedureIfCases() { yield return(new TestCaseData( TSql.NonQueryProcedureIf(true, "text"), new[] { new SqlNonQueryCommand("text", new DbParameter[0], CommandType.StoredProcedure) })); yield return(new TestCaseData( TSql.NonQueryProcedureIf(true, "text", parameters: null), new[] { new SqlNonQueryCommand("text", new DbParameter[0], CommandType.StoredProcedure) })); yield return(new TestCaseData( TSql.NonQueryProcedureIf(true, "text", new { }), new[] { new SqlNonQueryCommand("text", new DbParameter[0], CommandType.StoredProcedure) })); yield return(new TestCaseData( TSql.NonQueryProcedureIf(true, "text", new { Parameter = new SqlParameterValueStub() }), new[] { new SqlNonQueryCommand("text", new[] { new SqlParameterValueStub().ToDbParameter("@Parameter") }, CommandType.StoredProcedure) })); yield return(new TestCaseData( TSql.NonQueryProcedureIf(true, "text", new { Parameter1 = new SqlParameterValueStub(), Parameter2 = new SqlParameterValueStub() }), new[] { new SqlNonQueryCommand("text", new[] { new SqlParameterValueStub().ToDbParameter("@Parameter1"), new SqlParameterValueStub().ToDbParameter("@Parameter2") }, CommandType.StoredProcedure) })); yield return(new TestCaseData( TSql.NonQueryProcedureIf(false, "text"), new SqlNonQueryCommand[0])); yield return(new TestCaseData( TSql.NonQueryProcedureIf(false, "text", parameters: null), new SqlNonQueryCommand[0])); yield return(new TestCaseData( TSql.NonQueryProcedureIf(false, "text", new { }), new SqlNonQueryCommand[0])); yield return(new TestCaseData( TSql.NonQueryProcedureIf(false, "text", new { Parameter = new SqlParameterValueStub() }), new SqlNonQueryCommand[0])); yield return(new TestCaseData( TSql.NonQueryProcedureIf(false, "text", new { Parameter1 = new SqlParameterValueStub(), Parameter2 = new SqlParameterValueStub() }), new SqlNonQueryCommand[0])); }
public void NonQueryProcedureIfParameterCountNotLimitedTo2098WhenConditionIsNotMet() { Assert.DoesNotThrow(() => TSql.NonQueryProcedureIf(false, "", ParameterCountLimitedExceeded.Instance).ToArray()); }
public void NonQueryProcedureIfParameterCountLimitedTo2098WhenConditionIsMet() { Assert.Throws <ArgumentException>(() => TSql.NonQueryProcedureIf(true, "", ParameterCountLimitedExceeded.Instance).ToArray()); }