-
-
Notifications
You must be signed in to change notification settings - Fork 540
/
exceptions.yml
112 lines (92 loc) · 4.12 KB
/
exceptions.yml
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
- old: |
[ExpectedException(typeof(InvalidOperationException))]
public void MyTest()
{
func();
}
new: |
public void MyTest()
{
Action act = () => func();
act.Should().ThrowExactly<InvalidOperationException>();
}
old-message: |
Test method threw exception System.InvalidCastException, but exception System.ArgumentNullException was expected. Exception System.InvalidCastException: Specified cast is not valid.
new-message: |
Expected a <System.ArgumentNullException> to be thrown, but found a <System.InvalidCastException>: System.InvalidCastException with message "Specified cast is not valid."
at UnitTests2.ExceptionTests.<>c.<Snippet01_New>b__1_0() in C:\Path\To\UnitTests\ExceptionTests.cs:line 31
at UnitTests2.ExceptionTests.<>c__DisplayClass1_0.<Snippet01_New>b__1() in C:\Path\To\UnitTests\ExceptionTests.cs:line 34
at FluentAssertions.Specialized.ActionAssertions
.InvokeSubjectWithInterception()
.
- old: |
Action act = () => func();
// MSTest V2
Assert.ThrowsException<InvalidOperationException>(act);
new: |
Action act = () => func();
act.Should().ThrowExactly<InvalidOperationException>();
old-message: |
Assert.ThrowsException failed. Threw exception InvalidCastException, but exception ArgumentNullException was expected.
Exception Message: Specified cast is not valid.
Stack Trace: at UnitTests2.ExceptionTests.<>c.<Snippet01v2_Old>b__2_0() in C:\Path\To\UnitTests\ExceptionTests.cs:line 44
at UnitTests2.ExceptionTests.<>c__DisplayClass2_0.<Snippet01v2_Old>b__1() in C:\Path\To\UnitTests\ExceptionTests.cs:line 47
at Microsoft.VisualStudio.TestTools.UnitTesting.Assert
.ThrowsException[T](Action action, String message, Object[] parameters)
new-message: |
Expected a <System.ArgumentNullException> to be thrown, but found a <System.InvalidCastException>: System.InvalidCastException with message "Specified cast is not valid."
at UnitTests2.ExceptionTests.<>c.<Snippet01_New>b__1_0() in C:\Path\To\UnitTests\ExceptionTests.cs:line 31
at UnitTests2.ExceptionTests.<>c__DisplayClass1_0.<Snippet01_New>b__1() in C:\Path\To\UnitTests\ExceptionTests.cs:line 34
at FluentAssertions.Specialized.ActionAssertions
.InvokeSubjectWithInterception()
.
- old: |
[ExpectedException(typeof(SystemException),
AllowDerivedTypes = true)]
public void MyTest()
{
func();
}
new: |
public void MyTest()
{
Action act = () => func();
act.Should().Throw<InvalidOperationException>();
}
old-message: |
Test method threw exception System.InvalidCastException, but exception System.ArgumentException or a type derived from it was expected. Exception System.InvalidCastException: Specified cast is not valid.
new-message: |
Expected a <System.ArgumentException> to be thrown, but found a <System.InvalidCastException>: System.InvalidCastException with message "Specified cast is not valid."
at UnitTests2.ExceptionTests.<>c.<Snippet02_New>b__3_0() in C:\Path\To\UnitTests\ExceptionTests.cs:line 57
at UnitTests2.ExceptionTests.<>c__DisplayClass3_0.<Snippet02_New>b__1() in C:\Path\To\UnitTests\ExceptionTests.cs:line 60
at FluentAssertions.Specialized
.ActionAssertions.InvokeSubjectWithInterception().
- old: |
[ExpectedException(typeof(InvalidOperationException))]
public void MyTest()
{
try
{
func();
}
catch (InvalidOperationException ex)
{
ex.Message.Should().Be(errorMessage);
throw;
}
}
new: |
public void MyTest()
{
Action act = () => func();
act.Should().ThrowExactly<InvalidOperationException>()
.WithMessage(errorMessage);
}
old-message: |
Expected string to be
"expectedMessage" with a length of 15, but
"actualMessage" has a length of 13.
new-message: |
Expected exception message to match the equivalent of
"expectedMessage", but
"actualMessage" does not.