New in-theme classes: Buyers computes a shopping-list total, PriceList stands for the pricing service (random surge, flaky test). One loop, one lambda-able expression — the third example teaches the move with nothing else in the way. Pristine repo + reference solution (extract lambda, slide, extract method with Func<IceCream,int> parameter, pure-lambda test) + storyboard in the established style. Mirrors the kata's C# setup (net7.0, MSTest); needs a build check on a machine with the SDK.
20 lines
560 B
C#
20 lines
560 B
C#
using IceCreamBuyers;
|
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
|
|
namespace IceCreamBuyers.Tests
|
|
{
|
|
[TestClass]
|
|
public class BuyersTests
|
|
{
|
|
[TestMethod]
|
|
public void ShoppingListTotal()
|
|
{
|
|
// Anke: 2 flavours x 2 scoops x base prices (3 + 2) = 10.
|
|
// Red or flaky — why? (PriceList adds random surge pricing;
|
|
// it stands for the external pricing service.)
|
|
var buyers = new Buyers();
|
|
Assert.AreEqual(10, buyers.ShoppingListTotal("Anke"));
|
|
}
|
|
}
|
|
}
|