Esempio n. 1
0
        public void Class2()
        {
            var obj = new Class1.Class2();

            Assert.Equal("b", obj.GetString2());
            Assert.Equal("B", obj.GetString2Upper());
        }
Esempio n. 2
0
        public void Class2()
        {
            var obj2 = new Class1.Class2();

            Assert.AreEqual("b", obj2.GetString2());
            Assert.AreEqual("B", obj2.GetString2Upper());
            Assert.AreEqual("", obj2.GetString3Upper());

            Assert.AreEqual("xyz", obj2.GetString0());
            Assert.AreEqual("XYZ", obj2.GetString0Upper());
        }
        public void Class2()
        {
            var obj2 = new Class1.Class2();

            Assert.AreEqual("b", obj2.GetString2());
            Assert.AreEqual("B", obj2.GetString2Upper());
            Assert.AreEqual("", obj2.GetString3Upper());

            // Here we override the virtual methond (Getstring0) in the Class2 definition
            Assert.AreEqual("xyz", obj2.GetString0());
            Assert.AreEqual("XYZ", obj2.GetString0Upper());
        }
Esempio n. 4
0
        public void Class2()
        {
            var obj2 = new Class1.Class2(); //can access internal Class2 through internal Class1

            Assert.AreEqual("b", obj2.GetString2());
            Assert.AreEqual("B", obj2.GetString2Upper());
            Assert.AreEqual("", obj2.GetString3Upper()); //can call this method because it's extending object, but it returns "" for all types other than Class3

            //executes the overwritten method in Class2
            Assert.AreEqual("xyz", obj2.GetString0());
            Assert.AreEqual("XYZ", obj2.GetString0Upper());
        }