예제 #1
0
 public void ComposeIfCommandArrayReturnsComposer([Values(true, false)] bool condition)
 {
     Assert.IsInstanceOf <SqlNonQueryCommandComposer>(
         TSql.ComposeIf(
             condition,
             CommandFactory(),
             CommandFactory()));
 }
예제 #2
0
        public void ComposedIfCommandArrayIsNotPreservedAndReturnedByComposerWhenConditionIsFalse()
        {
            var command1 = CommandFactory();
            var command2 = CommandFactory();

            SqlNonQueryCommand[] result = TSql.ComposeIf(false, command1, command2);

            Assert.That(result, Is.EquivalentTo(new SqlNonQueryCommand[0]));
        }
예제 #3
0
 public void ComposeIfCommandEnumerationReturnsComposer([Values(true, false)] bool condition)
 {
     Assert.IsInstanceOf <SqlNonQueryCommandComposer>(
         TSql.ComposeIf(condition, (IEnumerable <SqlNonQueryCommand>) new[]
     {
         CommandFactory(),
         CommandFactory()
     }));
 }
예제 #4
0
        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
            }));
        }
예제 #5
0
 public void ComposeIfCommandEnumerationCanBeNullWhenConditionIsFalse()
 {
     Assert.DoesNotThrow(() => TSql.ComposeIf(false, (IEnumerable <SqlNonQueryCommand>)null));
 }
예제 #6
0
 public void ComposeIfCommandEnumerationCanNotBeNullWhenConditionIsTrue()
 {
     Assert.Throws <ArgumentNullException>(() => TSql.ComposeIf(true, (IEnumerable <SqlNonQueryCommand>)null));
 }
예제 #7
0
 public void ComposeIfCommandArrayCanBeNullWhenConditionIsFalse()
 {
     // ReSharper disable RedundantCast
     Assert.DoesNotThrow(() => TSql.ComposeIf(false, (SqlNonQueryCommand[])null));
     // ReSharper restore RedundantCast
 }
예제 #8
0
 public void ComposeIfCommandArrayCanNotBeNullWhenConditionIsTrue()
 {
     // ReSharper disable RedundantCast
     Assert.Throws <ArgumentNullException>(() => TSql.ComposeIf(true, (SqlNonQueryCommand[])null));
     // ReSharper restore RedundantCast
 }