public void should_call_default_constructor_of_base_class_when_call_derived_ctor_with_args()
        {
            var demoClass = new InheritanceConstructorCallDemoClass(1);

            string message = demoClass.ConstructorCallMessage;

            // please change the variable value to fix the test.
            const string expected = "InheritanceConstructorCallDemoClassBase::Ctor(int)";

            Assert.Equal(expected, message);
        }
        public void should_be_able_to_specify_which_ctor_of_current_class_to_call()
        {
            var demoClass = new InheritanceConstructorCallDemoClass(1, "1");

            string message = demoClass.ConstructorCallMessage;

            // please change the variable value to fix the test.
            const string expected = "InheritanceConstructorCallDemoClass::Ctor(int, string)";

            Assert.Equal(expected, message);
        }
Beispiel #3
0
        public void should_call_default_constructors_of_base_class()
        {
            var demoClass = new InheritanceConstructorCallDemoClass();

            string message = demoClass.ConstructorCallMessage;

            // please change the variable value to fix the test.
            string expected = "InheritanceConstructorCallDemoClassBase::Ctor()" + System.Environment.NewLine + "InheritanceConstructorCallDemoClass::Ctor()" + System.Environment.NewLine;

            Assert.Equal(expected, message);
        }
Beispiel #4
0
        public void should_be_able_to_specify_which_base_ctor_to_call()
        {
            var demoClass = new InheritanceConstructorCallDemoClass("1");

            string message = demoClass.ConstructorCallMessage;

            // please change the variable value to fix the test.
            string expected = "InheritanceConstructorCallDemoClassBase::Ctor(int)" + System.Environment.NewLine + "InheritanceConstructorCallDemoClass::Ctor(string)" + System.Environment.NewLine;

            Assert.Equal(expected, message);
        }
Beispiel #5
0
        public void should_be_able_to_specify_which_base_ctor_to_call()
        {
            var demoClass = new InheritanceConstructorCallDemoClass("1");

            string message = demoClass.ConstructorCallMessage;

            // please change the variable value to fix the test.
            const string expected = "";

            Assert.Equal(expected, message);
        }
Beispiel #6
0
        public void should_call_default_constructors_of_base_class()
        {
            var demoClass = new InheritanceConstructorCallDemoClass();

            string message = demoClass.ConstructorCallMessage;

            // please change the variable value to fix the test.
            const string expected = "";

            Assert.Equal(expected, message);
        }
        public void should_be_able_to_specify_which_base_ctor_to_call()
        {
            // should call method with string parameter in sub class, but in that method
            // first call abstract class with parsed int
            var demoClass = new InheritanceConstructorCallDemoClass("1");

            string message = demoClass.ConstructorCallMessage;

            // please change the variable value to fix the test.
            const string expected = "InheritanceConstructorCallDemoClassBase::Ctor(int)" + "\r\n" +
                                    "InheritanceConstructorCallDemoClass::Ctor(string)" + "\r\n";

            Assert.Equal(expected, message);
        }
        public void should_call_default_constructor_of_base_class_when_call_derived_ctor_with_args()
        {
            // new object with type of sub class, parameter is int
            //still call base constructor
            var demoClass = new InheritanceConstructorCallDemoClass(1);

            string message = demoClass.ConstructorCallMessage;

            // please change the variable value to fix the test.
            const string expected = "InheritanceConstructorCallDemoClassBase::Ctor()" + "\r\n" +
                                    "InheritanceConstructorCallDemoClass::Ctor(int)" + "\r\n";

            Assert.Equal(expected, message);
        }
        public void should_be_able_to_specify_which_ctor_of_current_class_to_call()
        {
            // call sub class with 2 args, in that method first call sub class with int arg
            // then excute the constructor with 2 args
            // why still call base constructor? here doesn't use base keyword
            var demoClass = new InheritanceConstructorCallDemoClass(1, "1");

            string message = demoClass.ConstructorCallMessage;

            // please change the variable value to fix the test.
            const string expected = "InheritanceConstructorCallDemoClassBase::Ctor()" + "\r\n" +
                                    "InheritanceConstructorCallDemoClass::Ctor(int)" + "\r\n"
                                    + "InheritanceConstructorCallDemoClass::Ctor(int, string)" + "\r\n";

            Assert.Equal(expected, message);
        }