コード例 #1
0
        public void AddLineTest()
        {
            AssertionFailureMessage afm;

            afm = new AssertionFailureMessage();
            Assert.AreEqual(String.Empty, afm.ToString());
            afm = new AssertionFailureMessage(TestLine);
            Assert.AreEqual(TestLine, afm.ToString());
            afm = new AssertionFailureMessage("Line {0}", 1);
            Assert.AreEqual(TestLine, afm.ToString());
            afm = new AssertionFailureMessage();
            afm.AddLine(TestLine);
            Assert.AreEqual(String.Concat(afm.NewLine, TestLine), afm.ToString());
            afm = new AssertionFailureMessage();
            afm.AddLine("Line {0}", 1);
            Assert.AreEqual(String.Concat(afm.NewLine, TestLine), afm.ToString());
            afm = new AssertionFailureMessage();
            afm.AddExpectedLine(TestLine);
            Assert.AreEqual(String.Concat(afm.NewLine, "\texpected: ", TestLine), afm.ToString());
            afm = new AssertionFailureMessage();
            afm.AddActualLine(TestLine);
            Assert.AreEqual(String.Concat(afm.NewLine, "\t but was: ", TestLine), afm.ToString());
        }
コード例 #2
0
        public void DisplayMethodTest()
        {
            AssertionFailureMessage afm;
            AssertionFailureMessage afm2;

            afm = new AssertionFailureMessage();
            afm.DisplayExpectedValue(TestLine);
            afm2 = new AssertionFailureMessage();
            afm2.AddExpectedLine(String.Concat("<\"", TestLine, "\">"));
            Assert.AreEqual(afm2.ToString(), afm.ToString());

            afm = new AssertionFailureMessage();
            afm.DisplayActualValue(TestLine);
            afm2 = new AssertionFailureMessage();
            afm2.AddActualLine(String.Concat("<\"", TestLine, "\">"));
            Assert.AreEqual(afm2.ToString(), afm.ToString());

            afm = new AssertionFailureMessage();
            afm.DisplayExpectedAndActual(TestLine, TestLine);
            afm2 = new AssertionFailureMessage();
            afm2.DisplayExpectedValue(TestLine);
            afm2.DisplayActualValue(TestLine);
            Assert.AreEqual(afm2.ToString(), afm.ToString());
        }