-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_0001_Two_sum_Test.cs
More file actions
72 lines (59 loc) · 1.74 KB
/
_0001_Two_sum_Test.cs
File metadata and controls
72 lines (59 loc) · 1.74 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
60
61
62
63
64
65
66
67
68
69
70
71
72
using FluentAssertions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Solution._0001.Two_sum;
namespace _0001.Two_sum.Tests
{
[TestClass()]
public class _0001_Two_sum_Test
{
_0001_Two_sum solution = new _0001_Two_sum();
[TestMethod()]
public void TwoSum_Test1()
{
// Arrange
int[] nums = { 2, 7, 11, 15 };
int target = 9;
var expected = new int[] { 0, 1 };
// Act
var actual = solution.TwoSum(nums, target);
// Assert
actual.Should().BeEquivalentTo(expected);
}
[TestMethod()]
public void TwoSum_Test2()
{
// Arrange
int[] nums = { 3, 2, 4 };
int target = 6;
var expected = new int[] { 1, 2 };
// Act
var actual = solution.TwoSum(nums, target);
// Assert
actual.Should().BeEquivalentTo(expected);
}
[TestMethod()]
public void TwoSum_Test3()
{
// Arrange
int[] nums = { 3, 3 };
int target = 6;
var expected = new int[] { 0, 1 };
// Act
var actual = solution.TwoSum(nums, target);
// Assert
actual.Should().BeEquivalentTo(expected);
}
[TestMethod()]
public void TwoSum_Test4()
{
// Arrange
int[] nums = { 1, 1, 1, 1, 1, 4, 1, 1, 1, 1, 1, 7, 1, 1, 1, 1, 1 };
int target = 11;
var expected = new int[] { 5, 11 };
// Act
var actual = solution.TwoSum(nums, target);
// Assert
actual.Should().BeEquivalentTo(expected);
}
}
}