Files
dotnet__skills/tests/dotnet/csharp-refactoring/golden-patches/extract-subtotal.patch
Abhitej John f4376065f3 Strengthen refactoring skill evaluations
Add powered, fixture-backed evals with public API, multi-targeting,
generated-code, and friend-assembly coverage.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 8c45529b-2515-483d-9e51-e6c0b7cb6852
2026-09-15 09:18:34 -07:00

34 lines
983 B
Diff

diff --git a/src/Billing/OrderProcessor.cs b/src/Billing/OrderProcessor.cs
index 449ef77..84199df 100644
--- a/src/Billing/OrderProcessor.cs
+++ b/src/Billing/OrderProcessor.cs
@@ -10,11 +10,7 @@ internal sealed class OrderProcessor
{
public Invoice DoStuff(IReadOnlyList<OrderLine> lines, string tier)
{
- decimal subtotal = 0m;
- foreach (var line in lines)
- {
- subtotal += line.UnitPrice * line.Quantity;
- }
+ decimal subtotal = CalculateSubtotal(lines);
decimal shipping = subtotal >= 100m ? 0m : 9.99m;
@@ -33,4 +29,15 @@ internal sealed class OrderProcessor
Math.Round(quoteWithTax, 2),
shipping);
}
+
+ private static decimal CalculateSubtotal(IReadOnlyList<OrderLine> lines)
+ {
+ decimal subtotal = 0m;
+ foreach (var line in lines)
+ {
+ subtotal += line.UnitPrice * line.Quantity;
+ }
+
+ return subtotal;
+ }
}