Tutorial

2.7 Run them

dotnet test
Passed!  - Failed:     0, Passed:    16, Skipped:     0, Total:    16, Duration: 816 ms - Shopfront.Tests.dll (net10.0)

Eleven are ours. The other five are the guards, which the fixtures bring with them.

Break something to see a test catch it. Change the empty-cart message in PriceCartJunction and run the tests again:

  Failed Run_EmptyCart_Throws [13 ms]
  Error Message:
   Expected exception message to match the equivalent of "The cart is empty.", but "Your cart is empty." does not.

Put the message back before going on.

What we have

Shopfront has a test project that checks each junction on its own, the train as a whole and the application over HTTP, and the guards check its shape. Every later chapter adds to it.

The record the train test reads lives in memory and is gone when the process ends. In chapter 3 we move it to Postgres, make the payment provider fail now and then, and read back what happened.

SDK Reference

ITrainBus | UseInMemory | SaveTrainParameters | Metadata | Mediator testing | Architecture guards


Next: 3. Every order is recorded