Example #1
0
        public void IsConstrainedBy_DifferentType_ThrowsArgumentException()
        {
            var ex = Assert.Throws <ArgumentException>(
                () => Require.IsConstrainedBy <string>(new object(), C_ParamName)
                );

            Assert.That(ex.ParamName, Is.EqualTo(C_ParamName));
        }
Example #2
0
        public void IsContrainedBy_NullForValueType_ThrowsArgumentNullException()
        {
            var ex = Assert.Throws <ArgumentNullException>(
                () => Require.IsConstrainedBy <int>(null, C_ParamName)
                );

            Assert.That(ex.ParamName, Is.EqualTo(C_ParamName));
        }
Example #3
0
        public void IsConstrainedBy_SameType_ReturnsValue()
        {
            var param = "hello";

            Assert.That(Require.IsConstrainedBy <string>(param, C_ParamName), Is.SameAs(param));
        }
Example #4
0
 public void IsConstrainedBy_NullForReferenceType_ReturnsNull()
 {
     Assert.That(Require.IsConstrainedBy <string>(null, C_ParamName), Is.Null);
 }