private static IEnumerable <TestCaseData> QueryStatementUnlessCases() { yield return(new TestCaseData( TSql.QueryStatementUnless(false, "text"), new[] { new SqlQueryCommand("text", new DbParameter[0], CommandType.Text) })); yield return(new TestCaseData( TSql.QueryStatementUnless(false, "text", parameters: null), new[] { new SqlQueryCommand("text", new DbParameter[0], CommandType.Text) })); yield return(new TestCaseData( TSql.QueryStatementUnless(false, "text", new { }), new[] { new SqlQueryCommand("text", new DbParameter[0], CommandType.Text) })); yield return(new TestCaseData( TSql.QueryStatementUnless(false, "text", new { Parameter = new SqlParameterValueStub() }), new[] { new SqlQueryCommand("text", new[] { new SqlParameterValueStub().ToDbParameter("@Parameter") }, CommandType.Text) })); yield return(new TestCaseData( TSql.QueryStatementUnless(false, "text", new { Parameter1 = new SqlParameterValueStub(), Parameter2 = new SqlParameterValueStub() }), new[] { new SqlQueryCommand("text", new[] { new SqlParameterValueStub().ToDbParameter("@Parameter1"), new SqlParameterValueStub().ToDbParameter("@Parameter2") }, CommandType.Text) })); yield return(new TestCaseData( TSql.QueryStatementUnless(true, "text"), new SqlQueryCommand[0])); yield return(new TestCaseData( TSql.QueryStatementUnless(true, "text", parameters: null), new SqlQueryCommand[0])); yield return(new TestCaseData( TSql.QueryStatementUnless(true, "text", new { }), new SqlQueryCommand[0])); yield return(new TestCaseData( TSql.QueryStatementUnless(true, "text", new { Parameter = new SqlParameterValueStub() }), new SqlQueryCommand[0])); yield return(new TestCaseData( TSql.QueryStatementUnless(true, "text", new { Parameter1 = new SqlParameterValueStub(), Parameter2 = new SqlParameterValueStub() }), new SqlQueryCommand[0])); }
public void QueryUnlessParameterCountNotLimitedTo2098WhenConditionIsMet() { Assert.Throws <ArgumentException>(() => TSql.QueryStatementUnless(false, "", ParameterCountLimitedExceeded.Instance).ToArray()); }
public void QueryUnlessParameterCountLimitedTo2098WhenConditionIsMet() { Assert.DoesNotThrow(() => TSql.QueryStatementUnless(true, "", ParameterCountLimitedExceeded.Instance).ToArray()); }