public void Duplicate() { HttpListener listener = new HttpListener(); HLPC coll = listener.Prefixes; coll.Add("http://127.0.0.1:8181/"); coll.Add("http://127.0.0.1:8181/"); listener.Start(); Assert.AreEqual(1, coll.Count, "Count"); Assert.IsFalse(coll.IsReadOnly, "IsReadOnly"); Assert.IsFalse(coll.IsSynchronized, "IsSynchronized"); listener.Stop(); }
public void Duplicate() { var port = NetworkHelpers.FindFreePort(); HttpListener listener = new HttpListener(); HLPC coll = listener.Prefixes; coll.Add($"http://127.0.0.1:{port}/"); coll.Add($"http://127.0.0.1:{port}/"); listener.Start(); Assert.AreEqual(1, coll.Count, "Count"); Assert.IsFalse(coll.IsReadOnly, "IsReadOnly"); Assert.IsFalse(coll.IsSynchronized, "IsSynchronized"); listener.Stop(); }
public void NL_AddBadUri() { HttpListener listener = new HttpListener(); HLPC coll = listener.Prefixes; coll.Add("httpblah://127.0.0.1:8181/"); }
public void Disposed2() { HttpListener listener = new HttpListener(); HLPC coll = listener.Prefixes; listener.Close(); coll.Add("http://localhost:7777/hola/"); }
public void DefaultProperties() { HttpListener listener = new HttpListener(); HLPC coll = listener.Prefixes; coll.Add("http://127.0.0.1:8181/"); Assert.AreEqual(1, coll.Count, "Count"); Assert.IsFalse(coll.IsReadOnly, "IsReadOnly"); Assert.IsFalse(coll.IsSynchronized, "IsSynchronized"); }
public void PercentSign() { HttpListener listener = new HttpListener(); HLPC coll = listener.Prefixes; // this one throws on Start(), not when adding it. // See same test name in HttpListenerTest. coll.Add("http://localhost:7777/hola%3E/"); string [] strs = new string [1]; coll.CopyTo(strs, 0); Assert.AreEqual("http://localhost:7777/hola%3E/", strs [0]); }
public void Disposed7() { HttpListener listener = new HttpListener(); HLPC coll = listener.Prefixes; coll.Add("http://127.0.0.1/"); listener.Close(); int items = 0; foreach (string s in coll) { items++; Assert.AreEqual(s, "http://127.0.0.1/"); } Assert.AreEqual(items, 1); }