示例#1
0
        public void givenIfFalse_whenIfThen_thenDontCallAction()
        {
            var thenAction = new Mock <Action>();

            FluentConditionals.If(false).Then(thenAction.Object);
            thenAction.Verify(action => action(), Times.Never);
        }
示例#2
0
        public void givenIfTrue_whenIfThen_thenCallAction()
        {
            var thenAction = new Mock <Action>();

            FluentConditionals.If(true).Then(thenAction.Object);

            thenAction.Verify(action => action(), Times.Once);
        }
示例#3
0
        public void givenIfFalse_whenIfThenElse_thenCallOnlyElseAction()
        {
            var thenAction = new Mock <Action>();
            var elseAction = new Mock <Action>();

            FluentConditionals.If(false).Then(thenAction.Object).Else(elseAction.Object);
            thenAction.Verify(action => action(), Times.Never);
            elseAction.Verify(action => action(), Times.Once);
        }
示例#4
0
 /// <summary>
 /// Alternative to FluentConditionals#If without the need of static imports.
 /// </summary>
 /// <param name="value"></param>
 /// <returns></returns>
 public static IFluentConditional _(bool value) => FluentConditionals.If(value);