System.Reflection.Tests.ConstructorInfoTests.Invoke_ExistingInstance C# (CSharp) Method

Invoke_ExistingInstance() private method

private Invoke_ExistingInstance ( ) : void
return void
        public void Invoke_ExistingInstance()
        {
            // Should not prouce a second object.
            ConstructorInfo[] constructors = GetConstructors(typeof(ClassWith3Constructors));
            ClassWith3Constructors obj1 = new ClassWith3Constructors(100, "hello");
            ClassWith3Constructors obj2 = (ClassWith3Constructors)constructors[2].Invoke(obj1, new object[] { 999, "initialized" });
            Assert.Null(obj2);
            Assert.Equal(obj1.intValue, 999);
            Assert.Equal(obj1.stringValue, "initialized");
        }