public void CastValidArgumentTest() { object input = "123"; var result = SafeCast.CastArgument <string>(input, "arg"); Assert.AreEqual(input, result); }
public void CastInvalidArgumentTest() { var action = new TestDelegate(() => SafeCast.CastArgument <string>(new object(), "arg")); Assert.That(action, Throws.ArgumentException); }
public void CastNullArgumentTest() { var action = new TestDelegate(() => SafeCast.CastArgument <string>(null, "arg")); Assert.That(action, Throws.InstanceOf <ArgumentNullException>()); }