public static void FindServicePoint_ReturnsCachedServicePoint()
{
const string Localhost = "http://localhost";
string address1 = "http://" + Guid.NewGuid().ToString("N");
string address2 = "http://" + Guid.NewGuid().ToString("N");
Assert.NotNull(ServicePointManager.FindServicePoint(new Uri(address1)));
Assert.Same(
ServicePointManager.FindServicePoint(address1, null),
ServicePointManager.FindServicePoint(address1, null));
Assert.Same(
ServicePointManager.FindServicePoint(address1, new FixedWebProxy(address1)),
ServicePointManager.FindServicePoint(address1, new FixedWebProxy(address1)));
Assert.Same(
ServicePointManager.FindServicePoint(address1, new FixedWebProxy(address1)),
ServicePointManager.FindServicePoint(address2, new FixedWebProxy(address1)));
Assert.Same(
ServicePointManager.FindServicePoint(Localhost, new FixedWebProxy(address1)),
ServicePointManager.FindServicePoint(Localhost, new FixedWebProxy(address2)));
Assert.NotSame(
ServicePointManager.FindServicePoint(address1, null),
ServicePointManager.FindServicePoint(address2, null));
Assert.NotSame(
ServicePointManager.FindServicePoint(address1, null),
ServicePointManager.FindServicePoint(address1, new FixedWebProxy(address1)));
Assert.NotSame(
ServicePointManager.FindServicePoint(address1, new FixedWebProxy(address1)),
ServicePointManager.FindServicePoint(address1, new FixedWebProxy(address2)));
}