public void ComposeIfCommandArrayReturnsComposer([Values(true, false)] bool condition) { Assert.IsInstanceOf <SqlNonQueryCommandComposer>( TSql.ComposeIf( condition, CommandFactory(), CommandFactory())); }
public void ComposedIfCommandArrayIsNotPreservedAndReturnedByComposerWhenConditionIsFalse() { var command1 = CommandFactory(); var command2 = CommandFactory(); SqlNonQueryCommand[] result = TSql.ComposeIf(false, command1, command2); Assert.That(result, Is.EquivalentTo(new SqlNonQueryCommand[0])); }
public void ComposeIfCommandEnumerationReturnsComposer([Values(true, false)] bool condition) { Assert.IsInstanceOf <SqlNonQueryCommandComposer>( TSql.ComposeIf(condition, (IEnumerable <SqlNonQueryCommand>) new[] { CommandFactory(), CommandFactory() })); }
public void ComposedIfCommandEnumerationIsPreservedAndReturnedByComposerWhenConditionIsTrue() { var command1 = CommandFactory(); var command2 = CommandFactory(); SqlNonQueryCommand[] result = TSql.ComposeIf(true, (IEnumerable <SqlNonQueryCommand>) new[] { command1, command2 }); Assert.That(result, Is.EquivalentTo(new[] { command1, command2 })); }
public void ComposeIfCommandEnumerationCanBeNullWhenConditionIsFalse() { Assert.DoesNotThrow(() => TSql.ComposeIf(false, (IEnumerable <SqlNonQueryCommand>)null)); }
public void ComposeIfCommandEnumerationCanNotBeNullWhenConditionIsTrue() { Assert.Throws <ArgumentNullException>(() => TSql.ComposeIf(true, (IEnumerable <SqlNonQueryCommand>)null)); }
public void ComposeIfCommandArrayCanBeNullWhenConditionIsFalse() { // ReSharper disable RedundantCast Assert.DoesNotThrow(() => TSql.ComposeIf(false, (SqlNonQueryCommand[])null)); // ReSharper restore RedundantCast }
public void ComposeIfCommandArrayCanNotBeNullWhenConditionIsTrue() { // ReSharper disable RedundantCast Assert.Throws <ArgumentNullException>(() => TSql.ComposeIf(true, (SqlNonQueryCommand[])null)); // ReSharper restore RedundantCast }