public void To_CorrespondingType() { var reflectedObject = new ReflectedObject("string"); String output = reflectedObject.To <String>(); Assert.That(output, Is.EqualTo("string")); }
public void To_InvalidCast() { var reflectedObject = new ReflectedObject("string"); try { reflectedObject.To <IDisposable>(); Assert.Fail("expected exception not thrown"); } catch (InvalidCastException invalidCastException) { Assert.That(invalidCastException.Message, Is.EqualTo("Unable to cast object of type 'System.String' to type 'System.IDisposable'.")); } }
public void To_InvalidCast() { var reflectedObject = new ReflectedObject ("string"); try { reflectedObject.To<IDisposable>(); Assert.Fail ("expected exception not thrown"); } catch (InvalidCastException invalidCastException) { Assert.That (invalidCastException.Message, Is.EqualTo ("Unable to cast object of type 'System.String' to type 'System.IDisposable'.")); } }
public void To_CorrespondingType() { var reflectedObject = new ReflectedObject ("string"); String output = reflectedObject.To<String>(); Assert.That (output, Is.EqualTo ("string")); }