-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_0240_Search_a_2D_matrix_II_Test.cs
More file actions
55 lines (46 loc) · 1.45 KB
/
_0240_Search_a_2D_matrix_II_Test.cs
File metadata and controls
55 lines (46 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Solution._0240.Search_a_2D_matrix_II;
namespace _0240.Search_a_2D_matrix_II.Tests
{
[TestClass()]
public class _0240_Search_a_2D_matrix_II_Test
{
_0240_Search_a_2D_matrix_II solution = new _0240_Search_a_2D_matrix_II();
[TestMethod()]
public void SearchMatrix_Test1()
{
// Arrange
int[][] matrix = new int[][]
{
new int[]{ 1, 4, 7, 11, 15 },
new int[]{ 2, 5, 8, 12, 19 },
new int[]{ 3, 6, 9, 16, 22 },
new int[]{ 10, 13, 14, 17, 24 },
new int[]{ 18, 21, 23, 26, 30 },
};
int target = 5;
// Act
var actual = solution.SearchMatrix(matrix, target);
// Assert
Assert.IsTrue(actual);
}
[TestMethod()]
public void SearchMatrix_Test2()
{
// Arrange
int[][] matrix = new int[][]
{
new int[]{ 1, 4, 7, 11, 15 },
new int[]{ 2, 5, 8, 12, 19 },
new int[]{ 3, 6, 9, 16, 22 },
new int[]{ 10, 13, 14, 17, 24 },
new int[]{ 18, 21, 23, 26, 30 },
};
int target = 20;
// Act
var actual = solution.SearchMatrix(matrix, target);
// Assert
Assert.IsFalse(actual);
}
}
}