-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_0704_Binary_search_Test.cs
More file actions
41 lines (34 loc) · 1000 Bytes
/
_0704_Binary_search_Test.cs
File metadata and controls
41 lines (34 loc) · 1000 Bytes
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
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Solution._0704.Binary_search;
namespace _0704.Binary_search.Tests
{
[TestClass()]
public class _0704_Binary_search_Test
{
_0704_Binary_search solution = new _0704_Binary_search();
[TestMethod()]
public void Search_Test1()
{
// Arrange
int[] nums = new int[] { -1, 0, 3, 5, 9, 12 };
int target = 9;
int expected = 4;
// Act
var actual = solution.Search(nums, target);
// Assert
Assert.AreEqual(expected, actual);
}
[TestMethod()]
public void Search_Test2()
{
// Arrange
int[] nums = new int[] { -1, 0, 3, 5, 9, 12 };
int target = 2;
int expected = -1;
// Act
var actual = solution.Search(nums, target);
// Assert
Assert.AreEqual(expected, actual);
}
}
}