diff options
author | Hugh Bellamy <hughbellars@gmail.com> | 2017-06-23 22:33:47 +0300 |
---|---|---|
committer | Dan Moseley <danmose@microsoft.com> | 2017-06-23 22:33:47 +0300 |
commit | 59915687bb261efeae70565d0ca8990ac45ceb9c (patch) | |
tree | 383131ec60df92b19c95d7103c1eb7e1bf577426 /src/System.Text.RegularExpressions | |
parent | 876acca296364f025a1920ecbe23bd0e5b547932 (diff) |
Convert most Assert.Throws<ArgumentException> without param name to AssertExtensions (#21455)
* Registry
* Collections
* ComponentModel
* Configuration
* Data
* Globalization
* Drawing
* Diagnostics
* IO
* Linq
* Add System.Net param names in tests
* Move ArgumentExceptions in System.Private.Xml to AssertExtensions
* Add System.Reflection.* ArgumentException param names
* Add param names for System.Runtime* ArgumentExceptions
* Add ArgumentException param names to System.Security.*
* Add ArgumentException param names to System.Text.*
* Add param names to ArgumentExceptions in misc projects
* Add System.Threading.* ArgumentException param names
* Fix missing files
* Fixes for unix and netfx
* Fix more failures and revert a IdnaConformance tests to avoid merge conflicts with #21463
Diffstat (limited to 'src/System.Text.RegularExpressions')
5 files changed, 9 insertions, 9 deletions
diff --git a/src/System.Text.RegularExpressions/tests/CaptureCollectionTests.netcoreapp.cs b/src/System.Text.RegularExpressions/tests/CaptureCollectionTests.netcoreapp.cs index 5e606a12f2..045f25d346 100644 --- a/src/System.Text.RegularExpressions/tests/CaptureCollectionTests.netcoreapp.cs +++ b/src/System.Text.RegularExpressions/tests/CaptureCollectionTests.netcoreapp.cs @@ -130,8 +130,8 @@ namespace System.Text.RegularExpressions.Tests ICollection<Capture> collection = CreateCollection(); AssertExtensions.Throws<ArgumentNullException>("array", () => collection.CopyTo((Capture[])null, 0)); AssertExtensions.Throws<ArgumentOutOfRangeException>("arrayIndex", () => collection.CopyTo(new Capture[1], -1)); - Assert.Throws<ArgumentException>(() => collection.CopyTo(new Capture[1], 0)); - Assert.Throws<ArgumentException>(() => collection.CopyTo(new Capture[1], 1)); + AssertExtensions.Throws<ArgumentException>(null, () => collection.CopyTo(new Capture[1], 0)); + AssertExtensions.Throws<ArgumentException>(null, () => collection.CopyTo(new Capture[1], 1)); AssertExtensions.Throws<ArgumentOutOfRangeException>("arrayIndex", () => collection.CopyTo(new Capture[1], 2)); } diff --git a/src/System.Text.RegularExpressions/tests/GroupCollectionTests.netcoreapp.cs b/src/System.Text.RegularExpressions/tests/GroupCollectionTests.netcoreapp.cs index 733b63ab8b..2b1f06a867 100644 --- a/src/System.Text.RegularExpressions/tests/GroupCollectionTests.netcoreapp.cs +++ b/src/System.Text.RegularExpressions/tests/GroupCollectionTests.netcoreapp.cs @@ -127,8 +127,8 @@ namespace System.Text.RegularExpressions.Tests ICollection<Group> collection = CreateCollection(); AssertExtensions.Throws<ArgumentNullException>("array", () => collection.CopyTo(null, 0)); AssertExtensions.Throws<ArgumentOutOfRangeException>("arrayIndex", () => collection.CopyTo(new Group[1], -1)); - Assert.Throws<ArgumentException>(() => collection.CopyTo(new Group[1], 0)); - Assert.Throws<ArgumentException>(() => collection.CopyTo(new Group[1], 1)); + AssertExtensions.Throws<ArgumentException>(null, () => collection.CopyTo(new Group[1], 0)); + AssertExtensions.Throws<ArgumentException>(null, () => collection.CopyTo(new Group[1], 1)); AssertExtensions.Throws<ArgumentOutOfRangeException>("arrayIndex", () => collection.CopyTo(new Group[1], 2)); } diff --git a/src/System.Text.RegularExpressions/tests/MatchCollectionTests.netcoreapp.cs b/src/System.Text.RegularExpressions/tests/MatchCollectionTests.netcoreapp.cs index c4120da59d..08a9c90b89 100644 --- a/src/System.Text.RegularExpressions/tests/MatchCollectionTests.netcoreapp.cs +++ b/src/System.Text.RegularExpressions/tests/MatchCollectionTests.netcoreapp.cs @@ -124,9 +124,9 @@ namespace System.Text.RegularExpressions.Tests ICollection<Match> collection = CreateCollection(); Assert.Throws<ArgumentNullException>(() => collection.CopyTo(null, 0)); Assert.Throws<ArgumentOutOfRangeException>(() => collection.CopyTo(new Match[1], -1)); - Assert.Throws<ArgumentException>(() => collection.CopyTo(new Match[1], 0)); - Assert.Throws<ArgumentException>(() => collection.CopyTo(new Match[1], 1)); - Assert.Throws<ArgumentException>(() => collection.CopyTo(new Match[1], 2)); + AssertExtensions.Throws<ArgumentException>("destinationArray", () => collection.CopyTo(new Match[1], 0)); + AssertExtensions.Throws<ArgumentException>("destinationArray", () => collection.CopyTo(new Match[1], 1)); + AssertExtensions.Throws<ArgumentException>("destinationArray", () => collection.CopyTo(new Match[1], 2)); } [Fact] diff --git a/src/System.Text.RegularExpressions/tests/Regex.Ctor.Tests.cs b/src/System.Text.RegularExpressions/tests/Regex.Ctor.Tests.cs index 5f563d00ef..16d121ee7d 100644 --- a/src/System.Text.RegularExpressions/tests/Regex.Ctor.Tests.cs +++ b/src/System.Text.RegularExpressions/tests/Regex.Ctor.Tests.cs @@ -254,7 +254,7 @@ namespace System.Text.RegularExpressions.Tests [InlineData("?((a)a|b", RegexOptions.None)] public void Ctor_InvalidPattern(string pattern, RegexOptions options) { - Assert.Throws<ArgumentException>(() => new Regex(pattern, options)); + AssertExtensions.Throws<ArgumentException>(null, () => new Regex(pattern, options)); } [Theory] diff --git a/src/System.Text.RegularExpressions/tests/Regex.Match.Tests.cs b/src/System.Text.RegularExpressions/tests/Regex.Match.Tests.cs index 6f33aa4f27..765f2e0147 100644 --- a/src/System.Text.RegularExpressions/tests/Regex.Match.Tests.cs +++ b/src/System.Text.RegularExpressions/tests/Regex.Match.Tests.cs @@ -752,7 +752,7 @@ namespace System.Text.RegularExpressions.Tests [InlineData("(?()|||||)")] public void Match_InvalidPattern(string pattern) { - Assert.Throws<ArgumentException>(() => Regex.Match("input", pattern)); + AssertExtensions.Throws<ArgumentException>(null, () => Regex.Match("input", pattern)); } [Fact] |