-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_1720_Decode_XORed_array_Test.cs
More file actions
46 lines (37 loc) · 1.21 KB
/
_1720_Decode_XORed_array_Test.cs
File metadata and controls
46 lines (37 loc) · 1.21 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
using Microsoft.VisualStudio.TestTools.UnitTesting;
using FluentAssertions;
using Solution._1720.Decode_XORed_array;
namespace _1720.Decode_XORed_array.Tests
{
[TestClass()]
public class _1720_Decode_XORed_array_Test
{
_1720_Decode_XORed_array s = new _1720_Decode_XORed_array();
[TestMethod()]
public void Decode_Test1()
{
// Arrange
int[] encoded = { 1, 2, 3 };
int first = 1;
int[] expected = { 1, 0, 2, 1 };
// Act
var actual = s.Decode(encoded, first);
// Assert 對參考型別是驗證記憶體位置, 故透過 FluentAssertions 套件來驗證其內容值
actual.Should().BeEquivalentTo(expected);
//Assert.AreEqual(expected, actual);
}
[TestMethod()]
public void Decode_Test2()
{
// Arrange
int[] encoded = { 6, 2, 7, 3 };
int first = 4;
int[] expected = { 4, 2, 0, 7, 4 };
// Act
var actual = s.Decode(encoded, first);
actual.Should().BeEquivalentTo(expected);
// Assert
//Assert.AreEqual(expected, actual);
}
}
}