public void TestUndoGzip() { // Test decompressing content that has been gzip'ed var asm = Assembly.GetExecutingAssembly(); var inS = asm.GetManifestResourceStream( "TrotiNet.Test.Resources.raven.gzip"); Assert.AreEqual(13833, inS.Length); var expS = asm.GetManifestResourceStream( "TrotiNet.Test.Resources.raven.html"); Assert.AreEqual(38930, expS.Length); var dummy_proxy = new DummyProxy("gzip"); var outS = dummy_proxy.GetResponseMessageStream(inS); int avail = (int) expS.Length; byte[] b1 = new byte[1024]; byte[] b2 = new byte[1024]; while (avail > 0) { int to_read = avail < 1024 ? avail : 1024; int r1 = outS.Read(b1, 0, to_read); Assert.AreEqual(to_read, r1); int r2 = expS.Read(b2, 0, to_read); avail -= r2; Assert.AreEqual(to_read, r2); for (int i = 0; i < 1024; i++) Assert.AreEqual(b2[i], b1[i]); } }
public static void Proxy_Roundtrips() { var wc = new WebClient(); Assert.Same(WebRequest.DefaultWebProxy, wc.Proxy); var p = new DummyProxy(); wc.Proxy = p; Assert.Same(p, wc.Proxy); wc.Proxy = null; Assert.Null(wc.Proxy); }
/// <summary> /// Notifies the TItem about the event; /// Disconnects the item from the model tree; /// Sets the TItem's slot in the collection's array to null. /// </summary> internal override void PrivateDisconnectChild(TableColumn item) { Debug.Assert(item != null); // notify the TItem about the change item.OnExitParentTree(); // remove the item from collection's array Items[item.Index] = null; item.Index = -1; // remove from model tree // If the item is parented through a proxy then the parent link of the item is // not to Owner and we should not change the parentage. DummyProxy proxy = item.Parent as DummyProxy; if (proxy == null) { Owner.RemoveLogicalChild(item); } }
public void TestUndoGzip() { // Test decompressing content that has been gzip'ed var asm = Assembly.GetExecutingAssembly(); var inS = asm.GetManifestResourceStream( "TrotiNet.Test.Resources.raven.gzip"); Assert.AreEqual(13833, inS.Length); var expS = asm.GetManifestResourceStream( "TrotiNet.Test.Resources.raven.html"); Assert.AreEqual(38930, expS.Length); var dummy_proxy = new DummyProxy("gzip"); var outS = dummy_proxy.GetResponseMessageStream(inS); int avail = (int)expS.Length; byte[] b1 = new byte[1024]; byte[] b2 = new byte[1024]; while (avail > 0) { int to_read = avail < 1024 ? avail : 1024; int r1 = outS.Read(b1, 0, to_read); Assert.AreEqual(to_read, r1); int r2 = expS.Read(b2, 0, to_read); avail -= r2; Assert.AreEqual(to_read, r2); for (int i = 0; i < 1024; i++) { Assert.AreEqual(b2[i], b1[i]); } } }