Docs · API reference · Motus.Assertions
ResponseAssertions Class#
Assertions about a response the browser received, obtained from That(IResponse).
public sealed class ResponseAssertions
Inheritance System.Object → ResponseAssertions
Remarks#
These do not retry, unlike the locator and page assertions. A response is a completed fact rather than a moving target, so re-reading its status could never change the answer.
Properties#
Not Property#
Inverts the assertion that follows, so it passes when the condition does not hold.
public Motus.Assertions.ResponseAssertions Not { get; }
Property Value#
Methods#
ToBeOkAsync() Method#
Asserts that the response carries a success status, meaning 200 through 299.
public System.Threading.Tasks.Task ToBeOkAsync();
Returns#
Exceptions#
MotusAssertionException
The status falls outside that range.
ToHaveStatusAsync(int) Method#
Asserts that the response's status code equals the expected one.
public System.Threading.Tasks.Task ToHaveStatusAsync(int expected);
Parameters#
expected System.Int32
The status code required, such as 404.
Returns#
Exceptions#
MotusAssertionException
The status differs from the expected one.