|
9 | 9 | using System.Net.Test.Common; |
10 | 10 | using System.Runtime.Serialization.Formatters.Binary; |
11 | 11 | using System.Text; |
| 12 | +using System.Threading; |
12 | 13 | using System.Threading.Tasks; |
13 | 14 |
|
14 | 15 | using Xunit; |
@@ -485,22 +486,15 @@ public void AllowAutoRedirect_SetAndGetBoolean_ValuesMatch(Uri remoteServer) |
485 | 486 | Assert.False(request.AllowAutoRedirect); |
486 | 487 | } |
487 | 488 |
|
488 | | - [Theory, MemberData(nameof(EchoServers))] |
489 | | - [SkipOnTargetFramework(TargetFrameworkMonikers.Netcoreapp, "ConnectionGroupName isn't implemented in Core")] |
490 | | - public void ConnectionGroupName_SetAndGetGroup_ValuesMatch(Uri remoteServer) |
| 489 | + [Fact] |
| 490 | + public void ConnectionGroupName_SetAndGetGroup_ValuesMatch() |
491 | 491 | { |
492 | | - HttpWebRequest request = WebRequest.CreateHttp(remoteServer); |
493 | | - |
494 | | - if (!PlatformDetection.IsFullFramework) |
495 | | - { |
496 | | - Assert.Throws<NotImplementedException>(() => request.ConnectionGroupName); |
497 | | - } |
498 | | - else |
499 | | - { |
500 | | - Assert.Null(request.ConnectionGroupName); |
501 | | - request.ConnectionGroupName = "Group"; |
502 | | - Assert.Equal("Group", request.ConnectionGroupName); |
503 | | - } |
| 492 | + // Note: In CoreFX changing this value will not have any effect on HTTP stack's behavior. |
| 493 | + // For app-compat reasons we allow applications to alter and read the property. |
| 494 | + HttpWebRequest request = WebRequest.CreateHttp("http://test"); |
| 495 | + Assert.Null(request.ConnectionGroupName); |
| 496 | + request.ConnectionGroupName = "Group"; |
| 497 | + Assert.Equal("Group", request.ConnectionGroupName); |
504 | 498 | } |
505 | 499 |
|
506 | 500 | [Theory, MemberData(nameof(EchoServers))] |
@@ -740,13 +734,29 @@ public void ProtocolVersion_SetThenGetHttpVersions_ValuesMatch(Uri remoteServer) |
740 | 734 | Assert.Equal(HttpVersion.Version11, request.ProtocolVersion); |
741 | 735 | } |
742 | 736 |
|
743 | | - [Theory, MemberData(nameof(EchoServers))] |
744 | | - [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "Implemented in .NET Framework")] |
745 | | - public void ReadWriteTimeout_SetThenGet_ThrowsNotImplementedException(Uri remoteServer) |
| 737 | + [Fact] |
| 738 | + public void ReadWriteTimeout_SetThenGet_ValuesMatch() |
746 | 739 | { |
747 | | - HttpWebRequest request = WebRequest.CreateHttp(remoteServer); |
748 | | - Assert.Throws<NotImplementedException>(() => request.ReadWriteTimeout = 5); |
749 | | - Assert.Throws<NotImplementedException>(() => request.ReadWriteTimeout); |
| 740 | + // Note: In CoreFX changing this value will not have any effect on HTTP stack's behavior. |
| 741 | + // For app-compat reasons we allow applications to alter and read the property. |
| 742 | + HttpWebRequest request = WebRequest.CreateHttp("http://test"); |
| 743 | + request.ReadWriteTimeout = 5; |
| 744 | + Assert.Equal(5, request.ReadWriteTimeout); |
| 745 | + } |
| 746 | + |
| 747 | + [Fact] |
| 748 | + public void ReadWriteTimeout_InfiniteValue_Ok() |
| 749 | + { |
| 750 | + HttpWebRequest request = WebRequest.CreateHttp("http://test"); |
| 751 | + request.ReadWriteTimeout = Timeout.Infinite; |
| 752 | + } |
| 753 | + |
| 754 | + [Fact] |
| 755 | + public void ReadWriteTimeout_NegativeOrZeroValue_Fail() |
| 756 | + { |
| 757 | + HttpWebRequest request = WebRequest.CreateHttp("http://test"); |
| 758 | + Assert.Throws<ArgumentOutOfRangeException>(() => { request.ReadWriteTimeout = 0; }); |
| 759 | + Assert.Throws<ArgumentOutOfRangeException>(() => { request.ReadWriteTimeout = -10; }); |
750 | 760 | } |
751 | 761 |
|
752 | 762 | [Theory, MemberData(nameof(EchoServers))] |
|
0 commit comments