You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/bunit.core/Extensions/WaitForHelpers/RenderedFragmentWaitForHelperExtensions.cs
+88Lines changed: 88 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -37,6 +37,34 @@ public static void WaitForState(this IRenderedFragmentBase renderedFragment, Fun
37
37
}
38
38
}
39
39
40
+
/// <summary>
41
+
/// Wait until the provided <paramref name="statePredicate"/> action returns true,
42
+
/// or the <paramref name="maxRenderCount"/> is reached.
43
+
///
44
+
/// The <paramref name="statePredicate"/> is evaluated initially, and then each time
45
+
/// the <paramref name="renderedFragment"/> renders.
46
+
/// </summary>
47
+
/// <param name="renderedFragment">The render fragment or component to attempt to verify state against.</param>
48
+
/// <param name="statePredicate">The predicate to invoke after each render, which must returns <c>true</c> when the desired state has been reached.</param>
49
+
/// <param name="maxRenderCount">The number of renders of <paramref name="renderedFragment"/> should wait at most.</param>
50
+
/// <exception cref="WaitForFailedException">Thrown if the <paramref name="statePredicate"/> throw an exception during invocation, or if the timeout has been reached. See the inner exception for details.</exception>
51
+
/// <remarks>
52
+
/// If a debugger is attached the timeout is set to <see cref="Timeout.InfiniteTimeSpan" />, giving the possibility to debug without the timeout triggering.
/// Wait until the provided <paramref name="statePredicate"/> action returns true,
88
+
/// or the <paramref name="maxRenderCount"/> is reached.
89
+
///
90
+
/// The <paramref name="statePredicate"/> is evaluated initially, and then each time
91
+
/// the <paramref name="renderedFragment"/> renders.
92
+
/// </summary>
93
+
/// <param name="renderedFragment">The render fragment or component to attempt to verify state against.</param>
94
+
/// <param name="statePredicate">The predicate to invoke after each render, which must returns <c>true</c> when the desired state has been reached.</param>
95
+
/// <param name="maxRenderCount">The number of renders of <paramref name="renderedFragment"/> should wait at most.</param>
96
+
/// <exception cref="WaitForFailedException">Thrown if the <paramref name="statePredicate"/> throw an exception during invocation, or if the timeout has been reached. See the inner exception for details.</exception>
/// Wait until the provided <paramref name="assertion"/> passes (i.e. does not throw an
60
106
/// exception), or the <paramref name="timeout"/> is reached (default is one second).
@@ -80,6 +126,31 @@ public static void WaitForAssertion(this IRenderedFragmentBase renderedFragment,
80
126
}
81
127
}
82
128
129
+
/// <summary>
130
+
/// Wait until the provided <paramref name="assertion"/> passes (i.e. does not throw an exception),
131
+
/// or the <paramref name="maxRenderCount"/> is reached.
132
+
///
133
+
/// The <paramref name="assertion"/> is attempted initially, and then each time the <paramref name="renderedFragment"/> renders.
134
+
/// </summary>
135
+
/// <param name="renderedFragment">The rendered fragment to wait for renders from and assert against.</param>
136
+
/// <param name="assertion">The verification or assertion to perform.</param>
137
+
/// <param name="maxRenderCount">The number of renders of <paramref name="renderedFragment"/> should wait at most.</param>
138
+
/// <exception cref="WaitForFailedException">Thrown if the timeout has been reached. See the inner exception to see the captured assertion exception.</exception>
/// Wait until the provided <paramref name="assertion"/> passes (i.e. does not throw an exception),
174
+
/// or the <paramref name="maxRenderCount"/> is reached.
175
+
/// The <paramref name="assertion"/> is attempted initially, and then each time the <paramref name="renderedFragment"/> renders.
176
+
/// </summary>
177
+
/// <param name="renderedFragment">The rendered fragment to wait for renders from and assert against.</param>
178
+
/// <param name="assertion">The verification or assertion to perform.</param>
179
+
/// <param name="maxRenderCount">The number of renders of <paramref name="renderedFragment"/> should wait at most.</param>
180
+
/// <exception cref="WaitForFailedException">Thrown if the timeout has been reached. See the inner exception to see the captured assertion exception.</exception>
@@ -36,4 +40,29 @@ public WaitForAssertionHelper(IRenderedFragmentBase renderedFragment, Action ass
36
40
},
37
41
timeout)
38
42
{}
43
+
44
+
/// <summary>
45
+
/// Initializes a new instance of the <see cref="WaitForAssertionHelper"/> class,
46
+
/// which will until the provided <paramref name="assertion"/> passes (i.e. does not throw an
47
+
/// or the <paramref name="maxRenderCount"/> is reached.
48
+
///
49
+
/// The <paramref name="assertion"/> is attempted initially, and then each time the <paramref name="renderedFragment"/> renders.
50
+
/// </summary>
51
+
/// <param name="renderedFragment">The rendered fragment to wait for renders from and assert against.</param>
52
+
/// <param name="assertion">The verification or assertion to perform.</param>
53
+
/// <param name="maxRenderCount">The number of renders of <paramref name="renderedFragment"/> should wait at most.</param>
54
+
/// <remarks>
55
+
/// If a debugger is attached the timeout is set to <see cref="Timeout.InfiniteTimeSpan" />, giving the possibility to debug without the timeout triggering.
0 commit comments