Пример #1
0
        public virtual void TestEquals()
        {
            RawText           a   = new RawText(Constants.EncodeASCII("foo-a\nfoo-b\n"));
            RawText           b   = new RawText(Constants.EncodeASCII("foo-b\nfoo-c\n"));
            RawTextComparator cmp = RawTextComparator.DEFAULT;

            NUnit.Framework.Assert.AreEqual(2, a.Size());
            NUnit.Framework.Assert.AreEqual(2, b.Size());
            // foo-a != foo-b
            NUnit.Framework.Assert.IsFalse(cmp.Equals(a, 0, b, 0));
            NUnit.Framework.Assert.IsFalse(cmp.Equals(b, 0, a, 0));
            // foo-b == foo-b
            NUnit.Framework.Assert.IsTrue(cmp.Equals(a, 1, b, 0));
            NUnit.Framework.Assert.IsTrue(cmp.Equals(b, 0, a, 1));
        }
        public virtual void TestEqualsWithoutWhitespace()
        {
            RawText a = new RawText(Constants.EncodeASCII("foo-a\nfoo-b\nfoo\n"));
            RawText b = new RawText(Constants.EncodeASCII("foo-b\nfoo-c\nf\n"));

            NUnit.Framework.Assert.AreEqual(3, a.Size());
            NUnit.Framework.Assert.AreEqual(3, b.Size());
            // foo-a != foo-b
            NUnit.Framework.Assert.IsFalse(cmp.Equals(a, 0, b, 0));
            NUnit.Framework.Assert.IsFalse(cmp.Equals(b, 0, a, 0));
            // foo-b == foo-b
            NUnit.Framework.Assert.IsTrue(cmp.Equals(a, 1, b, 0));
            NUnit.Framework.Assert.IsTrue(cmp.Equals(b, 0, a, 1));
            // foo != f
            NUnit.Framework.Assert.IsFalse(cmp.Equals(a, 2, b, 2));
            NUnit.Framework.Assert.IsFalse(cmp.Equals(b, 2, a, 2));
        }