示例#1
0
        public void AgainstNullArgument_FalseCondition_NoException()
        {
            string param = "notNull";

            Assert.That(() => Guard.AgainstNullArgument("param", param), Throws.Nothing);
            Assert.That(() => new GuardSubject().Method("notNull"), Throws.Nothing);
        }
示例#2
0
        public void AgainstNullArgument_TrueCondition_ExceptionWithDefaultMessageAndParam()
        {
            string param = null, paramName = "param", actualMessage = new ArgumentNullException(paramName).Message;

            Assert.That(() => Guard.AgainstNullArgument(paramName, param),
                        Throws.InstanceOf <ArgumentNullException>()
                        .With.Property("Message").EqualTo(actualMessage).IgnoreCase
                        .And.With.Property("ParamName").EqualTo(paramName));

            Assert.That(() => new GuardSubject().Method(null),
                        Throws.InstanceOf <ArgumentNullException>()
                        .With.Property("Message").EqualTo(actualMessage).IgnoreCase
                        .And.With.Property("ParamName").EqualTo(paramName));
        }
示例#3
0
 public void Method(string param)
 {
     Guard.AgainstNullArgument("param", param);
 }