Example #1
0
        public void CastValidValueTest()
        {
            object input = "123";

            var result = SafeCast.Cast <string>(input, "text {0}", "text");

            Assert.AreEqual(input, result);
        }
Example #2
0
        public void CastInvalidValueTest()
        {
            var action = new TestDelegate(() => SafeCast.Cast <string>(new object(), "text {0}", "text"));

            Assert.That(action, Throws.InvalidOperationException);
        }