API accepts a JSON payload (xUnit)
Generated output
Section titled “Generated output”### ✅ API accepts a JSON payload
- **Given** the client has the following JSON payload **Payload** ```json { "password": "secret", "rememberMe": true } ```- **When** the client sends the request- **Then** the response status should be 200- **And** the response body should include "token"C# code
Section titled “C# code”using ExecutableStories.Xunit;using Xunit;
public class ApiTests : IDisposable{ [Fact] public void ApiAcceptsJsonPayload() { Story.Init("API accepts a JSON payload"); Story.Given("the client has the following JSON payload"); Story.Json("Payload", new { password = "secret", rememberMe = true }); Story.When("the client sends the request"); Story.Then("the response status should be 200"); Story.Then("the response body should include \"token\""); }
public void Dispose() => Story.RecordAndClear();}