Files
agentd-livetest/tests/Prices.Tests/PriceCalculatorTests.cs
Honegger, Florian 3f086f9dca Seed: price calculator with discount tests
Mini project for agentd live testing: three of the five tests fail on main.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-05 00:40:48 +02:00

37 lines
811 B
C#

using Xunit;
namespace Prices.Tests;
public sealed class PriceCalculatorTests
{
[Fact]
public void No_discount_keeps_the_price()
{
Assert.Equal(100m, PriceCalculator.ApplyDiscount(100m, 0m));
}
[Fact]
public void A_full_discount_makes_it_free()
{
Assert.Equal(0m, PriceCalculator.ApplyDiscount(200m, 100m));
}
[Fact]
public void A_quarter_off_200_is_150()
{
Assert.Equal(150m, PriceCalculator.ApplyDiscount(200m, 25m));
}
[Fact]
public void Half_off_80_is_40()
{
Assert.Equal(40m, PriceCalculator.ApplyDiscount(80m, 50m));
}
[Fact]
public void A_discount_above_100_percent_is_refused()
{
Assert.Throws<ArgumentOutOfRangeException>(() => PriceCalculator.ApplyDiscount(100m, 101m));
}
}