Skip to content

Conversation component demo

A worked example of fixing a bug in a WinForms app:

claude — InvoiceForm fix
You

The invoice total in InvoiceForm is wrong when a discount and tax both apply. Find the cause and fix it.

Claude

Let me look at how the total is calculated.

Readsrc/Forms/InvoiceForm.cs

Found it — the discount is applied to Subtotal twice: once before tax and again in RecalculateTotal(). I’ll remove the duplicate.

Editsrc/Forms/InvoiceForm.cs
Bashdotnet test --filter InvoiceTests
Result

Passed! - Failed: 0, Passed: 14, Skipped: 0

Fixed. The discount now applies once, before tax, and all invoice tests pass.