Exemplo n.º 1
0
        static void Main(string[] args)
        {
            ReflectionSample sample = new ReflectionSample();

            sample.Test();

            Console.ReadLine();
        }
        public void should_set_and_get_property()
        {
            var          instance   = new ReflectionSample();
            const string expectedId = "SuperCoolId";

            SetProperty(instance, "Id", expectedId);
            Assert.Equal(expectedId, GetProperty(instance, "Id"));
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            ReflectionSample sample = new ReflectionSample();

            // 测试创建实例.
            sample.TestNewClass();

            // 测试 GET/SET
            sample.TestGetSetProp();

            // 测试 调用方法.
            sample.TestCall();

            Console.ReadLine();
        }
        public void should_invoke_public_ctor()
        {
            ReflectionSample instance = InvokeConstructor(typeof(ReflectionSample).FullName, "the name");

            Assert.Equal("Constructor with parameter: the name", instance.Message);
        }
        public void should_invoke_public_default_ctor()
        {
            ReflectionSample instance = InvokeConstructor(typeof(ReflectionSample).FullName);

            Assert.Equal("Default constructor", instance.Message);
        }
 public void TestReflectionSample()
 {
     ReflectionSample sample = new ReflectionSample();
     var results             = sample.ExecuteRectangle();
 }
        public void should_get_original_exception()
        {
            var instance = new ReflectionSample();

            Assert.Throws <NotSupportedException>(() => GetProperty(instance, "ThrowsProperty"));
        }