-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_0074_Search_a_2D_Matrix_Test.cs
More file actions
47 lines (40 loc) · 1.2 KB
/
_0074_Search_a_2D_Matrix_Test.cs
File metadata and controls
47 lines (40 loc) · 1.2 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
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Solution._0074.Search_a_2D_Matrix;
namespace _0074.Search_a_2D_Matrix.Tests
{
[TestClass()]
public class _0074_Search_a_2D_Matrix_Test
{
_0074_Search_a_2D_Matrix solution = new _0074_Search_a_2D_Matrix();
[TestMethod()]
public void SearchMatrix_Test1()
{
// Arrange
int[][] matrix = new int[][] {
new int[]{ 1, 3, 5, 7 },
new int[]{ 10, 11, 16, 20 },
new int[]{ 23, 30, 34, 60 },
};
int target = 3;
// Act
var actual = solution.SearchMatrix(matrix, target);
// Assert
Assert.IsTrue(actual);
}
[TestMethod()]
public void SearchMatrix_Test2()
{
// Arrange
int[][] matrix = new int[][] {
new int[]{ 1, 3, 5, 7 },
new int[]{ 10, 11, 16, 20 },
new int[]{ 23, 30, 34, 60 },
};
int target = 13;
// Act
var actual = solution.SearchMatrix(matrix, target);
// Assert
Assert.IsFalse(actual);
}
}
}