-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathTests.cs
More file actions
67 lines (58 loc) · 1.63 KB
/
Tests.cs
File metadata and controls
67 lines (58 loc) · 1.63 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
using Xunit;
namespace DEdge.Diffract.CSharp.Tests
{
public class Tests
{
[Fact]
public void Poco()
{
var expected = new MyPoco { Item = new MyInnerPoco(1, "a", 1) };
var actual = new MyPoco { Item = new MyInnerPoco(2, "a", 2) };
Assert.Equal("Item.X Expect = 1\n Actual = 2\n",
Differ.ToString(expected, actual));
}
[Fact]
public void FieldPoco()
{
var expected = new MyFieldPoco(1, "a");
var actual = new MyFieldPoco(2, "a");
Assert.Equal("X Expect = 1\n Actual = 2\n",
Differ.ToString(expected, actual));
}
[Fact]
public void Record()
{
var expected = new MyRecord(1, "a");
var actual = new MyRecord(2, "a");
Assert.Equal("X Expect = 1\n Actual = 2\n",
Differ.ToString(expected, actual));
}
public class MyInnerPoco
{
public int X { get; }
public string Y { get; }
private int Z { get; }
public MyInnerPoco(int x, string y, int z)
{
X = x;
Y = y;
Z = z;
}
}
public class MyPoco
{
public MyInnerPoco Item { get; init; }
}
public class MyFieldPoco
{
public int X;
public string Y;
public MyFieldPoco(int x, string y)
{
X = x;
Y = y;
}
}
public record MyRecord(int X, string Y);
}
}