forked from fluentassertions/fluentassertions
/
ContinuationOfGiven.cs
33 lines (28 loc) · 1 KB
/
ContinuationOfGiven.cs
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
namespace FluentAssertions.Execution
{
/// <summary>
/// Enables chaining multiple assertions from a <see cref="AssertionScope.Given{T}"/> call.
/// </summary>
public class ContinuationOfGiven<TSubject>
{
#region Private Definitions
private readonly bool succeeded;
#endregion
public ContinuationOfGiven(GivenSelector<TSubject> parent, bool succeeded)
{
Then = parent;
this.succeeded = succeeded;
}
/// <summary>
/// Continuous the assertion chain if the previous assertion was successful.
/// </summary>
public GivenSelector<TSubject> Then { get; }
/// <summary>
/// Provides back-wards compatibility for code that expects <see cref="AssertionScope.FailWith"/> to return a boolean.
/// </summary>
public static implicit operator bool(ContinuationOfGiven<TSubject> continuationOfGiven)
{
return continuationOfGiven.succeeded;
}
}
}