public void Create_ConstructorWithWrappedArguments() { var reflectedObject = ReflectedObject.Create(typeof(string).Assembly, "System.String", 'x', new ReflectedObject(5)); var expectedOutput = new String('x', 5); Assert.That(reflectedObject.To <string>(), Is.EqualTo(expectedOutput)); }
public void Create_ConstructorWithInvalidArguments() { try { ReflectedObject.Create(typeof(string).Assembly, "System.String", "string constructor is not overloaded with string"); Assert.Fail("expected exception not thrown"); } catch (MissingMethodException missingMethodException) { Assert.That(missingMethodException.Message, Is.EqualTo("Constructor on type 'System.String' not found.")); } }
public void Create_DefaultConstructor() { var reflectedObject = ReflectedObject.Create(typeof(int).Assembly, "System.Int32"); Assert.That(reflectedObject.To <int>(), Is.EqualTo(0)); }