public void SwitchTypeNoValidCase() { bool executed = false; var item = new TypeB(); item.Switch( SwitchType.Case <TypeA>(() => executed = true)); Assert.False(executed); }
public void SwitchDefaultExecuted() { bool executed = false; var item = new TypeB(); item.Switch( SwitchType.Case <TypeA>(() => Expression.Empty()), SwitchType.Default(() => executed = true)); Assert.True(executed); }
public void SwitchTypeHappyFlow() { bool executed = false; var item = new TypeA(); item.Switch( SwitchType.Case <TypeA>(() => executed = true), SwitchType.Default(() => throw new Exception("This case should not be executed."))); Assert.True(executed); }