コード例 #1
0
 public void Can_Guard_With_Specific_Exception()
 {
     Assert.Throws <OutOfMemoryException>(() => Guard.Against <OutOfMemoryException>(true, "Out Of memory"));
 }
コード例 #2
0
 public void Will_Not_Throw_If_Condition_Is_Not_Met()
 {
     Assert.DoesNotThrow(() => Guard.Against(false, string.Empty));
     Assert.DoesNotThrow(() => Guard.Against <Exception>(false, string.Empty));
 }
コード例 #3
0
 public void Can_Guard_Against_Wrong_Conditions()
 {
     Assert.Throws <InvalidOperationException>(() => Guard.Against(true, "Value Wrong"));
 }