Exemple #1
0
        public void ThrowIf_exception_uses_passed_error_message()
        {
            var errorMessage = "error";

            var ex = Assert.Throws <ArgumentException>(() => Guards.ThrowIf(1 < 2, errorMessage));

            Assert.Equal(errorMessage, ex.Message);
        }
Exemple #2
0
        public void ThrowIf_returns_invoker_to_allow_chaining_more_guards()
        {
            var result = Guards.ThrowIf(6 == 9, "message");

            Assert.IsType <GuardInvoker>(result);
        }
Exemple #3
0
 public void ThrowIf_does_not_throw_when_conditioon_false()
 {
     Guards.ThrowIf(1 > 2, "message");
 }
Exemple #4
0
 public void ThrowIf_throws_when_conditioon_true()
 {
     Assert.Throws <ArgumentException>(() => Guards.ThrowIf(1 < 2, "message"));
 }