-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_0036_Valid_sudoku_Test.cs
More file actions
59 lines (52 loc) · 2.05 KB
/
_0036_Valid_sudoku_Test.cs
File metadata and controls
59 lines (52 loc) · 2.05 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
56
57
58
59
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Solution._0036.Valid_sudoku;
namespace _0036.Valid_sudoku.Tests
{
[TestClass()]
public class _0036_Valid_sudoku_Test
{
_0036_Valid_sudoku solution = new _0036_Valid_sudoku();
[TestMethod()]
public void IsValidSudoku_Test1()
{
// Arrange
char[][] board = new char[][]
{
new char[]{ '5','3','.','.','7','.','.','.','.' },
new char[]{ '6','.','.','1','9','5','.','.','.' },
new char[]{ '.','9','8','.','.','.','.','6','.' },
new char[]{ '8','.','.','.','6','.','.','.','3' },
new char[]{ '4','.','.','8','.','3','.','.','1' },
new char[]{ '7','.','.','.','2','.','.','.','6' },
new char[]{ '.','6','.','.','.','.','2','8','.' },
new char[]{ '.','.','.','4','1','9','.','.','5' },
new char[]{ '.','.','.','.','8','.','.','7','9' },
};
// Act
var actual = solution.IsValidSudoku(board);
// Assert
Assert.IsTrue(actual);
}
[TestMethod()]
public void IsValidSudoku_Test2()
{
// Arrange
char[][] board = new char[][]
{
new char[]{ '8','3','.','.','7','.','.','.','.' },
new char[]{ '6','.','.','1','9','5','.','.','.' },
new char[]{ '.','9','8','.','.','.','.','6','.' },
new char[]{ '8','.','.','.','6','.','.','.','3' },
new char[]{ '4','.','.','8','.','3','.','.','1' },
new char[]{ '7','.','.','.','2','.','.','.','6' },
new char[]{ '.','6','.','.','.','.','2','8','.' },
new char[]{ '.','.','.','4','1','9','.','.','5' },
new char[]{ '.','.','.','.','8','.','.','7','9' },
};
// Act
var actual = solution.IsValidSudoku(board);
// Assert
Assert.IsFalse(actual);
}
}
}