예제 #1
0
        public override void Execute()
        {
            base.Execute();
            PassFailInContext(m_onPass, m_onFail, out m_onPass, out m_onFail);
            m_baseStr   = Utilities.evalExpr(m_of);
            m_targetStr = Utilities.evalExpr(m_to);
            // m_baseStr and m_targetStr can be null
            XmlStringDiff xsDiff = new XmlStringDiff(m_baseStr, m_targetStr);

            m_diffs  = xsDiff.getDiffString();
            m_Result = xsDiff.AreEqual();
            // Does it really want diffs from expected diffs?
            if (m_expect != null)
            {
                XmlStringDiff xsDiffEx = new XmlStringDiff(m_expect, m_diffs);
                m_diffs  = xsDiffEx.getDiffString();
                m_Result = xsDiffEx.AreEqual();
            }
            if ((m_onPass == "assert" && m_Result == true) ||
                (m_onFail == "assert" && m_Result == false))
            {
                if (m_message != null)
                {
                    fail(m_message.Read());
                }
                else
                {
                    fail("Match-strings Assert: Result = '" + m_Result + "', on-pass='******', on-fail='" + m_onFail + "', diffs='" + m_diffs + "'");
                }
            }
            m_log.result(this);
            Finished = true;             // tell do-once it's done
        }
예제 #2
0
		public void ConstructorTest()
		{
			string sBase = "<hi>this base is not null</hi>";
			string sTarget = "<hi>this target is not null</hi>";
			XmlStringDiff xsDiff = new XmlStringDiff(sBase, sTarget);
			Assert.IsNotNull(xsDiff,"Constructor with null strings is null.");
		}
예제 #3
0
		public void AreNotEqualTest()
		{
			string sBase = "<hi again = 'false'>So  what's down?<ans>The <sky bgcolor='gray'/>!</ans></hi>";
			string sTarget = "<hi again=\"true\">So what's up?<ans>The <sky color=\"blue\"/>!</ans></hi>";
			XmlStringDiff xsDiff = new XmlStringDiff(sBase, sTarget);
			Assert.AreEqual(false,xsDiff.AreEqual(),"Two equal xml strings fail to be identical");
		}
예제 #4
0
		public override void Execute()
		{
			base.Execute();
			PassFailInContext(m_onPass,m_onFail,out m_onPass,out m_onFail);
			m_baseStr   = Utilities.evalExpr(m_of);
			m_targetStr = Utilities.evalExpr(m_to);
			// m_baseStr and m_targetStr can be null
			XmlStringDiff xsDiff = new XmlStringDiff(m_baseStr, m_targetStr);
			m_diffs = xsDiff.getDiffString();
			m_Result = xsDiff.AreEqual();
			// Does it really want diffs from expected diffs?
			if (m_expect != null)
			{
				XmlStringDiff xsDiffEx = new XmlStringDiff(m_expect, m_diffs);
				m_diffs = xsDiffEx.getDiffString();
				m_Result = xsDiffEx.AreEqual();
			}
			if ((m_onPass == "assert" && m_Result == true)
				||(m_onFail == "assert" && m_Result == false) )
			{
				if (m_message != null)
					fail(m_message.Read());
				else
					fail("Match-strings Assert: Result = '"+m_Result+ "', on-pass='******', on-fail='"+m_onFail+"', diffs='"+m_diffs+"'");
			}
			m_log.result(this);
			Finished = true; // tell do-once it's done
		}
예제 #5
0
		public void ConstructorBothNullTest()
		{
			string sBase = "";
			string sTarget = "";
			XmlStringDiff xsDiff = new XmlStringDiff(sBase, sTarget);
			Assert.IsNotNull(xsDiff,"Constructor with null strings is null.");
		}
예제 #6
0
        public void AreNotEqualTest()
        {
            string        sBase   = "<hi again = 'false'>So  what's down?<ans>The <sky bgcolor='gray'/>!</ans></hi>";
            string        sTarget = "<hi again=\"true\">So what's up?<ans>The <sky color=\"blue\"/>!</ans></hi>";
            XmlStringDiff xsDiff  = new XmlStringDiff(sBase, sTarget);

            Assert.AreEqual(false, xsDiff.AreEqual(), "Two equal xml strings fail to be identical");
        }
예제 #7
0
        public void ConstructorTest()
        {
            string        sBase   = "<hi>this base is not null</hi>";
            string        sTarget = "<hi>this target is not null</hi>";
            XmlStringDiff xsDiff  = new XmlStringDiff(sBase, sTarget);

            Assert.IsNotNull(xsDiff, "Constructor with null strings is null.");
        }
예제 #8
0
        public void ConstructorBothNullTest()
        {
            string        sBase   = "";
            string        sTarget = "";
            XmlStringDiff xsDiff  = new XmlStringDiff(sBase, sTarget);

            Assert.IsNotNull(xsDiff, "Constructor with null strings is null.");
        }
예제 #9
0
        public void getDiffStringTest()
        {
            string        sBase     = "<hi again = 'true'>So  what's up?<ans>The <sky color='blue'/>!</ans></hi>";
            string        sTarget   = "<hi again=\"true\">So what's up?<ans>The <sky color=\"blue\"/>!</ans></hi>";
            XmlStringDiff xsDiff    = new XmlStringDiff(sBase, sTarget);
            string        diffs     = xsDiff.getDiffString();
            string        strExpect = "<equal/>";

            Assert.AreEqual(strExpect, diffs, "Diffgram of equal strings not correct");
        }
예제 #10
0
        public void getDiffStringFalseTest()
        {
            string        sBase     = "<hi again = 'false'>So  what's down?<ans>The <sky bgcolor='gray'/>!</ans></hi>";
            string        sTarget   = "<hi again=\"true\">So what's up?<ans>The <sky color=\"blue\"/>!</ans></hi>";
            XmlStringDiff xsDiff    = new XmlStringDiff(sBase, sTarget);
            string        diffs     = xsDiff.getDiffString();
            string        strExpect = "<xmldiff><node match=\"1\"><change match=\"@again\">true</change><change match=\"1\">So what's up?</change><node match=\"2\"><node match=\"2\"><add type=\"2\" name=\"color\">blue</add><remove match=\"@bgcolor\" /></node></node></node></xmldiff>";

            Assert.AreEqual(strExpect, diffs, "Diffgram of equal strings not correct");
        }
예제 #11
0
        public void DiffsNotEqualToExpectedTest()
        {
            string        sBase   = "<hi again = 'false'>So  what's up?<ans>The <sky bgcolor='gray'/>!</ans></hi>";
            string        sTarget = "<hi again=\"true\">So what's up?<ans>The <sky color=\"blue\"/>!</ans></hi>";
            XmlStringDiff xsDiff  = new XmlStringDiff(sBase, sTarget);
            string        diffs   = xsDiff.getDiffString();

            Assert.IsNotNull(diffs, "The base and target diffgram is null.");
            Assert.AreEqual(false, xsDiff.AreEqual());
            string        strExpect     = "<xmldiff><node match=\"1\"><change match=\"@again\">true</change><change match=\"1\">So what's up?</change><node match=\"2\"><node match=\"2\"><add type=\"2\" name=\"color\">blue</add><remove match=\"@bgcolor\" /></node></node></node></xmldiff>";
            XmlStringDiff xsDiffEx      = new XmlStringDiff(strExpect, diffs);
            string        strExpectDiff = xsDiffEx.getDiffString();

            Assert.IsNotNull(strExpectDiff, "The expected and 1st diffgram diffgram is null.");
            Assert.AreEqual(false, xsDiffEx.AreEqual());
            string strExpectical = "<equal/>";

            Assert.IsTrue(!strExpectical.Equals(strExpectDiff));
        }
예제 #12
0
		public void getDiffStringFalseTest()
		{
			string sBase = "<hi again = 'false'>So  what's down?<ans>The <sky bgcolor='gray'/>!</ans></hi>";
			string sTarget = "<hi again=\"true\">So what's up?<ans>The <sky color=\"blue\"/>!</ans></hi>";
			XmlStringDiff xsDiff = new XmlStringDiff(sBase, sTarget);
			string diffs = xsDiff.getDiffString();
			string strExpect ="<xmldiff><node match=\"1\"><change match=\"@again\">true</change><change match=\"1\">So what's up?</change><node match=\"2\"><node match=\"2\"><add type=\"2\" name=\"color\">blue</add><remove match=\"@bgcolor\" /></node></node></node></xmldiff>";
			Assert.AreEqual(strExpect, diffs, "Diffgram of equal strings not correct");
		}
예제 #13
0
		public void getDiffStringTest()
		{
			string sBase = "<hi again = 'true'>So  what's up?<ans>The <sky color='blue'/>!</ans></hi>";
			string sTarget = "<hi again=\"true\">So what's up?<ans>The <sky color=\"blue\"/>!</ans></hi>";
			XmlStringDiff xsDiff = new XmlStringDiff(sBase, sTarget);
			string diffs = xsDiff.getDiffString();
			string strExpect ="<equal/>";
			Assert.AreEqual(strExpect, diffs,"Diffgram of equal strings not correct");
		}
예제 #14
0
		public void DiffsNotEqualToExpectedTest()
		{
			string sBase = "<hi again = 'false'>So  what's up?<ans>The <sky bgcolor='gray'/>!</ans></hi>";
			string sTarget = "<hi again=\"true\">So what's up?<ans>The <sky color=\"blue\"/>!</ans></hi>";
			XmlStringDiff xsDiff = new XmlStringDiff(sBase, sTarget);
			string diffs = xsDiff.getDiffString();
			Assert.IsNotNull(diffs,"The base and target diffgram is null.");
			Assert.AreEqual(false,xsDiff.AreEqual());
			string strExpect = "<xmldiff><node match=\"1\"><change match=\"@again\">true</change><change match=\"1\">So what's up?</change><node match=\"2\"><node match=\"2\"><add type=\"2\" name=\"color\">blue</add><remove match=\"@bgcolor\" /></node></node></node></xmldiff>";
			XmlStringDiff xsDiffEx = new XmlStringDiff(strExpect, diffs);
			string strExpectDiff = xsDiffEx.getDiffString();
			Assert.IsNotNull(strExpectDiff,"The expected and 1st diffgram diffgram is null.");
			Assert.AreEqual(false,xsDiffEx.AreEqual());
			string strExpectical = "<equal/>";
			Assert.IsTrue(!strExpectical.Equals(strExpectDiff));
		}