Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
0
 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."));
     }
 }
Exemplo n.º 3
0
        public void Create_DefaultConstructor()
        {
            var reflectedObject = ReflectedObject.Create(typeof(int).Assembly, "System.Int32");

            Assert.That(reflectedObject.To <int>(), Is.EqualTo(0));
        }