public void StringExplicitOperatorTest()
        {
            //Assert.Inconclusive();


            MyString s1 = (MyString)"I love you";

            Assert.AreEqual(s1, "I love you");
            Assert.IsTrue(s1 == "I love you");

            MyString s2 = (MyString)"You love me";

            Assert.AreEqual(s2, "You love me");
            Assert.IsTrue(s2 == "You love me");


            Assert.AreNotEqual(s1, s2);
            Assert.IsFalse(s1 == s2);
        }
        public void StringReverseExplicitOperatorTest()
        {
            //Assert.Inconclusive();

            MyString s1  = new MyString("I love you");
            string   ss1 = (string)s1;

            Assert.AreEqual(ss1, "I love you");
            Assert.IsTrue(ss1 == "I love you");

            MyString s2  = new MyString("You love me");
            string   ss2 = (string)s2;

            Assert.AreEqual(ss2, "You love me");
            Assert.IsTrue(ss2 == "You love me");


            Assert.AreNotEqual(ss1, ss2);
            Assert.IsFalse(ss1 == ss2);
        }
        public void StringPlusPlusOperatorTest()
        {
            MyString s = (MyString)"I love you";

            Assert.AreEqual(++s, "I LOVE YOU");
        }
示例#4
0
        public void StringMinusMinusOperatorTest()
        {
            MyString s = (MyString)"YOU LOVE ME";

            Assert.AreEqual(s--, "you love me");
        }