public void guard_approves_func() { Func <bool> function = (Func <bool>) delegate { return(true); }; Assert.That(Guards.Approve(function), Is.True); }
public void falsey_Function_returns_false() { Func <bool> falseyGuard = delegate() { return(false); }; Assert.False(Guards.Approve(falseyGuard)); }
public void guard_instance_without_approve_throws_error() { Assert.Throws(typeof(Exception), new TestDelegate(() => { object invalidGuard = new object(); Guards.Approve(invalidGuard); } )); }
public void guard_approves_func_list() { Func <bool> function = (Func <bool>) delegate { return(true); }; Assert.That(Guards.Approve(new List <Func <bool> > { function, happyFunction }), Is.True); }
public void guards_with_a_grumpy_Class_returns_false() { Assert.False(Guards.Approve(typeof(HappyGuard), typeof(GrumpyGuard))); }
public void guard_with_injections_returns_true_if_injected_guard_says_so() { injector.Map <BossGuard>().ToValue(new BossGuard(true)); Assert.True(Guards.Approve(injector, typeof(JustTheMiddleManGuard))); }
public void happy_Instance_returns_true() { Assert.True(Guards.Approve(new HappyGuard())); }
public void grumpy_Instance_returns_false() { Assert.False(Guards.Approve(new GrumpyGuard())); }
public void happy_Class_returns_true() { Assert.True(Guards.Approve(typeof(HappyGuard))); }
public void grumpy_Class_returns_false() { Assert.False(Guards.Approve(typeof(GrumpyGuard))); }
public void happy_Function_returns_true() { Assert.True(Guards.Approve((Func <bool>)happyFunction)); }
public void grumpy_Function_returns_false() { Assert.False(Guards.Approve(new object[] { (Func <bool>)grumpyFunction })); }
public void guards_with_a_grumpy_Function_returns_false() { Assert.False(Guards.Approve(happyFunction, grumpyFunction)); }
public void guards_with_a_grumpy_Instance_returns_false() { Assert.False(Guards.Approve(new HappyGuard(), new GrumpyGuard())); }