Exemplo n.º 1
0
        public void CastValidArgumentTest()
        {
            object input = "123";

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

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

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

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