public void Test_Large_Partial() { count = 0; AsynchElementStream es = new AsynchElementStream(); es.OnElement += new ProtocolHandler(es_OnElement); es.Push(ENC.GetBytes("<stream>")); string test = "<presence from='*****@*****.**' to='[email protected]/Test' type='error'><error code='404' type='cancel'><remote-server-not-found xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error></presence><presence from='*****@*****.**' to='[email protected]/Test' type='error'><error code='404' type='cancel'><remote-server-not-found xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error></presence><presence from='*****@*****.**' to='[email protected]/Test' type='error'><error code='404' type='cancel'><remote-server-not-found xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error></presence><presence from='*****@*****.**' to='[email protected]/Test' type='error'><error code='404' type='cancel'><remote-server-not-found xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error></presence><presence from='*****@*****.**' to='[email protected]/Test' type='error'><error code='404' type='cancel'><remote-server-not-found xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error></presence><presence from='*****@*****.**' to='[email protected]/Test' type='error'><error code='404' type='cancel'><remote-server-not-found xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error></presence><presence from='*****@*****.**' to='[email protected]/Test' type='error'><error code='404' type='cancel'><remote-server-not-found xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error></presence><presence from='*****@*****.**' to='[email protected]/Test' type='error'><error code='404' type='cancel'><remote-server-not-found xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error></presence><presence from='*****@*****.**' to='[email protected]/Test' type='error'><error code='404' type='cancel'><remote-server-not-found xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error></presence><presence from='[email protected]/Home' to='[email protected]/Test'><priority>1</priority><c xmlns='http://jabber.org/protocol/caps' node='http://pidgin.im/caps' ver='2.3.1' ext='moodn nickn tunen avatar'/><x xmlns='vcard-temp:x:update'><photo>d206b82e4c1478ab033dacc55eacb1cfda7706c8</photo></x></presence><presence from='*****@*****.**' to='[email protected]/Test' type='error'><error code='404' type='cancel'><remote-server-not-found xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error></presence><presence from='*****@*****.**' to='[email protected]/Test' type='error'><error code='404' type='cancel'><remote-server-not-found xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error></presence><presence from='*****@*****.**' to='[email protected]/Test' type='error'><error code='404' type='cancel'><remote-server-not-found xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error></presence><presence from='*****@*****.**' to='[email protected]/Test' type='error'><error code='404' type='cancel'><remote-server-not-found xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error></presence><presence from='*****@*****.**' to='[email protected]/Test' type='error'><error code='404' type='cancel'><remote-server-not-found xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error></presence><presence from='*****@*****.**' to='[email protected]/Test' type='error'><error code='404' type='cancel'><remote-server-not-found xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error></presence><presence from='*****@*****.**' to='[email protected]/Test' type='error'><error code='404' type='cancel'><remote-server-not-found xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error></presence><presence from='*****@*****.**' to='[email protected]/Test' type='error'><error code='404' type='cancel'><remote-server-not-found xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error></presence><presence from='*****@*****.**' to='[email protected]/Test' type='error'><error code='404' type='cancel'><remote-server-not-found xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error></presence><presence from='*****@*****.**' to='[email protected]/Test' type='error'><error code='404' type='cance"; es.Push(ENC.GetBytes(test)); test = "l'><remote-server-not-found xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error></presence>"; es.Push(ENC.GetBytes(test)); Assert.AreEqual(count, 20); }
public void Test_Large() { AsynchElementStream es = new AsynchElementStream(); // es.OnElement += new ProtocolHandler(jabOnElement); es.Push(ENC.GetBytes("<stream>")); byte[] buf = ENC.GetBytes("<test/>"); MemoryStream ms = new MemoryStream(); for (int i=0; i<1024; i++) { ms.Write(buf, 0, buf.Length); } es.Push(ms.ToArray()); }
[Test] public void Test_Parse() { AsynchElementStream es = new AsynchElementStream(); es.AddFactory(new global::jabber.protocol.x.Factory()); es.OnElement += new ProtocolHandler(es_OnElement); es.Push(System.Text.Encoding.UTF8.GetBytes(tstring)); Assert.IsTrue(gotElement); }
public void Test_Partial() { fail = false; AsynchElementStream es = new AsynchElementStream(); es.OnDocumentEnd += new ObjectHandler(jabOnEnd); es.Push(ENC.GetBytes("<stream>")); es.OnElement += new ProtocolHandler(jabOnElement); es.Push(ENC.GetBytes("<te")); are.WaitOne(100, true); Assert.IsTrue(! fail); es.Push(ENC.GetBytes("st/>")); es.Push(ENC.GetBytes("<test>")); es.Push(ENC.GetBytes("</")); es.Push(ENC.GetBytes("test>")); es.Push(ENC.GetBytes("<test>")); es.Push(ENC.GetBytes("16;est</test>")); es.Push(ENC.GetBytes("<test>")); es.Push(new byte[] {0xC5}); es.Push(new byte[] {0x81}); es.Push(ENC.GetBytes("</test>")); es.Push(ENC.GetBytes("<test f")); es.Push(ENC.GetBytes("oo='bar'/>")); es.Push(ENC.GetBytes("<test foo=")); es.Push(ENC.GetBytes("'bar'/>")); es.Push(ENC.GetBytes("<test foo='")); es.Push(ENC.GetBytes("bar'/>")); es.Push(new byte[] {} ); }