Skip to content

Commit 61facd2

Browse files
committed
Fix: snoarqube smells, IPAddressCollection
1 parent 953615f commit 61facd2

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/System.Net.IPNetwork/IPNetwork2ToUint.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ internal static bool InternalToBigInteger(bool tryParse, IPAddress ipaddress, ou
154154
{
155155
if (!tryParse)
156156
{
157-
throw new ArgumentException("ipaddress");
157+
throw new ArgumentException(nameof(ipaddress));
158158
}
159159

160160
uintIpAddress = default;

src/System.Net.IPNetwork/IPNetworkCollection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ private BigInteger Network
6464

6565
if (cidrSubnet < ipnetwork.Cidr)
6666
{
67-
throw new ArgumentException(nameof(cidrSubnet));
67+
throw new ArgumentException("cidrSubnet < ipnetwork.Cidr", nameof(cidrSubnet));
6868
}
6969

7070
this.cidrSubnet = cidrSubnet;

src/TestProject/IPAddressCollectionUnitTest.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ public void TestEnumeratorFailed()
196196
Assert.ThrowsExactly<ArgumentOutOfRangeException>(() =>
197197
{
198198
var ipn = IPNetwork2.Parse("192.168.1.0/29");
199-
using IEnumerator<IPAddress> ips = ipn.ListIPAddress();
199+
using IPAddressCollection ips = ipn.ListIPAddress();
200200
ips.Reset();
201201
while (ips.MoveNext())
202202
{
@@ -214,7 +214,7 @@ public void TestEnumeratorFailed()
214214
public void TestEnumeratorMoveNext()
215215
{
216216
var ipn = IPNetwork2.Parse("192.168.1.0/29");
217-
using IEnumerator<IPAddress> ips = ipn.ListIPAddress();
217+
using IPAddressCollection ips = ipn.ListIPAddress();
218218
Assert.IsTrue(ips.MoveNext());
219219
Assert.IsTrue(ips.MoveNext());
220220
Assert.IsTrue(ips.MoveNext());
@@ -234,7 +234,7 @@ public void TestEnumeratorMoveNext()
234234
public void TestEnumeratorMoveNext2()
235235
{
236236
var ipn = IPNetwork2.Parse("192.168.1.0/31");
237-
using IEnumerator<IPAddress> ips = ipn.ListIPAddress();
237+
using IPAddressCollection ips = ipn.ListIPAddress();
238238
Assert.IsTrue(ips.MoveNext());
239239
Assert.IsTrue(ips.MoveNext());
240240
Assert.IsFalse(ips.MoveNext());
@@ -403,7 +403,7 @@ public void Test_ipv6_Reset()
403403
public void Tes_ipv6_tResetEnumerator()
404404
{
405405
var ipn = IPNetwork2.Parse("::/125");
406-
using IEnumerator<IPAddress> ips = ipn.ListIPAddress();
406+
using IPAddressCollection ips = ipn.ListIPAddress();
407407
ips.Reset();
408408
while (ips.MoveNext())
409409
{
@@ -426,7 +426,7 @@ public void Test_ipv6_EnumeratorFailed()
426426
Assert.ThrowsExactly<ArgumentOutOfRangeException>(() =>
427427
{
428428
var ipn = IPNetwork2.Parse("::/125");
429-
using IEnumerator<IPAddress> ips = ipn.ListIPAddress();
429+
using IPAddressCollection ips = ipn.ListIPAddress();
430430
ips.Reset();
431431
while (ips.MoveNext())
432432
{
@@ -443,7 +443,7 @@ public void Test_ipv6_EnumeratorFailed()
443443
public void Test_ipv6_EnumeratorMoveNext()
444444
{
445445
var ipn = IPNetwork2.Parse("::/125");
446-
using IEnumerator<IPAddress> ips = ipn.ListIPAddress();
446+
using IPAddressCollection ips = ipn.ListIPAddress();
447447
Assert.IsTrue(ips.MoveNext());
448448
Assert.IsTrue(ips.MoveNext());
449449
Assert.IsTrue(ips.MoveNext());
@@ -463,7 +463,7 @@ public void Test_ipv6_EnumeratorMoveNext()
463463
public void Test_ipv6_EnumeratorMoveNext2()
464464
{
465465
var ipn = IPNetwork2.Parse("::/127");
466-
using IEnumerator<IPAddress> ips = ipn.ListIPAddress();
466+
using IPAddressCollection ips = ipn.ListIPAddress();
467467
Assert.IsTrue(ips.MoveNext());
468468
Assert.IsTrue(ips.MoveNext());
469469
Assert.IsFalse(ips.MoveNext());

0 commit comments

Comments
 (0)