public void givenIfFalse_whenIfThen_thenDontCallAction() { var thenAction = new Mock <Action>(); FluentConditionals.If(false).Then(thenAction.Object); thenAction.Verify(action => action(), Times.Never); }
public void givenIfTrue_whenIfThen_thenCallAction() { var thenAction = new Mock <Action>(); FluentConditionals.If(true).Then(thenAction.Object); thenAction.Verify(action => action(), Times.Once); }
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); }
/// <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);