AssertCloneIsEqual() public static method

public static AssertCloneIsEqual ( Lucene.Net.Util.Attribute att ) : Lucene.Net.Util.Attribute
att Lucene.Net.Util.Attribute
return Lucene.Net.Util.Attribute
示例#1
0
        public virtual void  TestClone()
        {
            TermAttribute t = new TermAttribute();

            char[] content = "hello".ToCharArray();
            t.SetTermBuffer(content, 0, 5);
            char[]        buf  = t.TermBuffer();
            TermAttribute copy = (TermAttribute)TestSimpleAttributeImpls.AssertCloneIsEqual(t);

            Assert.AreEqual(t.Term, copy.Term);
            Assert.AreNotSame(buf, copy.TermBuffer());
        }
示例#2
0
        public virtual void  TestClone()
        {
            Token t = new Token(0, 5);

            char[] content = "hello".ToCharArray();
            t.SetTermBuffer(content, 0, 5);
            char[] buf  = t.TermBuffer();
            Token  copy = (Token)TestSimpleAttributeImpls.AssertCloneIsEqual(t);

            Assert.AreEqual(t.Term, copy.Term);
            Assert.AreNotSame(buf, copy.TermBuffer());

            Payload pl = new Payload(new byte[] { 1, 2, 3, 4 });

            t.Payload = pl;
            copy      = (Token)TestSimpleAttributeImpls.AssertCloneIsEqual(t);
            Assert.AreEqual(pl, copy.Payload);
            Assert.AreNotSame(pl, copy.Payload);
        }