Skip to content

Commit c521c21

Browse files
committed
Suppressed [Obsolete] warnings in tests
1 parent f6abfa8 commit c521c21

File tree

1 file changed

+24
-18
lines changed

1 file changed

+24
-18
lines changed

UnitTests/UnitTests.Shared/Extensions/Test_ArrayExtensions.cs

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ public void Test_ArrayExtensions_FillArrayMid()
1919
{
2020
bool[,] test = new bool[4, 5];
2121

22+
#pragma warning disable CS0618 // Type or member is obsolete
2223
test.Fill(true, 1, 1, 3, 2);
24+
#pragma warning restore CS0618
2325

2426
var expected = new bool[,]
2527
{
@@ -43,8 +45,10 @@ public void Test_ArrayExtensions_FillArrayTwice()
4345
{
4446
bool[,] test = new bool[4, 5];
4547

48+
#pragma warning disable CS0618 // Type or member is obsolete
4649
test.Fill(true, 0, 0, 1, 2);
4750
test.Fill(true, 1, 3, 2, 2);
51+
#pragma warning restore CS0618
4852

4953
var expected = new bool[,]
5054
{
@@ -68,7 +72,9 @@ public void Test_ArrayExtensions_FillArrayNegativeSize()
6872
{
6973
bool[,] test = new bool[4, 5];
7074

75+
#pragma warning disable CS0618 // Type or member is obsolete
7176
test.Fill(true, 3, 4, -3, -2);
77+
#pragma warning restore CS0618
7278

7379
// TODO: We may want to think about this pattern in the future:
7480
/*var expected = new bool[,]
@@ -101,7 +107,9 @@ public void Test_ArrayExtensions_FillArrayBottomEdgeBoundary()
101107
{
102108
bool[,] test = new bool[4, 5];
103109

110+
#pragma warning disable CS0618 // Type or member is obsolete
104111
test.Fill(true, 1, 2, 2, 4);
112+
#pragma warning restore CS0618
105113

106114
var expected = new bool[,]
107115
{
@@ -125,7 +133,9 @@ public void Test_ArrayExtensions_FillArrayTopLeftCornerNegativeBoundary()
125133
{
126134
bool[,] test = new bool[4, 5];
127135

136+
#pragma warning disable CS0618 // Type or member is obsolete
128137
test.Fill(true, -1, -1, 3, 3);
138+
#pragma warning restore CS0618
129139

130140
var expected = new bool[,]
131141
{
@@ -149,7 +159,9 @@ public void Test_ArrayExtensions_FillArrayBottomRightCornerBoundary()
149159
{
150160
bool[,] test = new bool[5, 4];
151161

162+
#pragma warning disable CS0618 // Type or member is obsolete
152163
test.Fill(true, 3, 2, 3, 3);
164+
#pragma warning restore CS0618
153165

154166
var expected = new bool[,]
155167
{
@@ -217,7 +229,9 @@ public void Test_ArrayExtensions_Rectangular_GetColumn()
217229
{ 7, -1, 0 }
218230
};
219231

232+
#pragma warning disable CS0618 // Type or member is obsolete
220233
var col = array.GetColumn(1).ToArray();
234+
#pragma warning restore CS0618
221235

222236
CollectionAssert.AreEquivalent(new int[] { 2, 3, -1 }, col);
223237
}
@@ -233,15 +247,10 @@ public void Test_ArrayExtensions_Rectangular_GetColumn_Exception()
233247
{ 7, 0, 0 }
234248
};
235249

236-
Assert.ThrowsException<ArgumentOutOfRangeException>(() =>
237-
{
238-
array.GetColumn(-1).ToArray();
239-
});
240-
241-
Assert.ThrowsException<ArgumentOutOfRangeException>(() =>
242-
{
243-
array.GetColumn(3).ToArray();
244-
});
250+
#pragma warning disable CS0618 // Type or member is obsolete
251+
Assert.ThrowsException<ArgumentOutOfRangeException>(() => array.GetColumn(-1).ToArray());
252+
Assert.ThrowsException<ArgumentOutOfRangeException>(() => array.GetColumn(3).ToArray());
253+
#pragma warning restore CS0618
245254
}
246255

247256
[TestCategory("ArrayExtensions")]
@@ -255,7 +264,9 @@ public void Test_ArrayExtensions_Rectangular_GetRow()
255264
{ 7, -1, 0 }
256265
};
257266

267+
#pragma warning disable CS0618 // Type or member is obsolete
258268
var col = array.GetRow(1).ToArray();
269+
#pragma warning restore CS0618
259270

260271
CollectionAssert.AreEquivalent(new int[] { 6, 3, 9 }, col);
261272
}
@@ -271,15 +282,10 @@ public void Test_ArrayExtensions_Rectangular_GetRow_Exception()
271282
{ 7, 0, 0 }
272283
};
273284

274-
Assert.ThrowsException<ArgumentOutOfRangeException>(() =>
275-
{
276-
array.GetRow(-1).ToArray();
277-
});
278-
279-
Assert.ThrowsException<ArgumentOutOfRangeException>(() =>
280-
{
281-
array.GetRow(3).ToArray();
282-
});
285+
#pragma warning disable CS0618 // Type or member is obsolete
286+
Assert.ThrowsException<ArgumentOutOfRangeException>(() => array.GetRow(-1).ToArray());
287+
Assert.ThrowsException<ArgumentOutOfRangeException>(() => array.GetRow(3).ToArray());
288+
#pragma warning restore CS0618
283289
}
284290

285291
[TestCategory("ArrayExtensions")]

0 commit comments

Comments
 (0)