Beispiel #1
0
        public void CastValidArgumentTest()
        {
            object input = "123";

            var result = SafeCast.CastArgument <string>(input, "arg");

            Assert.AreEqual(input, result);
        }
Beispiel #2
0
        public void CastInvalidArgumentTest()
        {
            var action = new TestDelegate(() => SafeCast.CastArgument <string>(new object(), "arg"));

            Assert.That(action, Throws.ArgumentException);
        }
Beispiel #3
0
        public void CastNullArgumentTest()
        {
            var action = new TestDelegate(() => SafeCast.CastArgument <string>(null, "arg"));

            Assert.That(action, Throws.InstanceOf <ArgumentNullException>());
        }