Пример #1
0
        public void AgainstArgument_TrueConditionMessage_ExceptionWithMessageAndParam()
        {
            string message = "message", param = "param";
            bool   trueCondition = 3 > 2;

            Assert.That(() => Guard.AgainstArgument(param, trueCondition, message),
                        Throws.ArgumentException.With.Property("Message").Contains(message).And.With.Property("ParamName").EqualTo(param));
        }
Пример #2
0
        public void AgainstArgumentNoMessage_TrueCondition_ExceptionWithDefaultMessageAndParam()
        {
            string param = "param", actualMessage = new ArgumentException(null, param).Message;
            bool   trueCondition = 3 > 2;

            Assert.That(() => Guard.AgainstArgument(param, trueCondition),
                        Throws.ArgumentException.With.Property("Message").EqualTo(actualMessage).IgnoreCase
                        .And.With.Property("ParamName").EqualTo(param));
        }
Пример #3
0
 public void AgainstArgumentNoMessage_FalseCondition_NoException()
 {
     Assert.That(() => Guard.AgainstArgument("param", "asd" == null), Throws.Nothing);
 }