From 8fa4a915c4ad31f72c97f56501ade37bebde3d41 Mon Sep 17 00:00:00 2001 From: Ksi Date: Sat, 6 Jul 2024 23:37:11 +0200 Subject: [PATCH] Add tests for Update of ConjuredMaturingStrategy --- .../ConjuredMaturingStrategyTests.cs | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 tests/Core.Tests/ProposedCode/MaturingStrategies/ConjuredMaturingStrategyTests.cs diff --git a/tests/Core.Tests/ProposedCode/MaturingStrategies/ConjuredMaturingStrategyTests.cs b/tests/Core.Tests/ProposedCode/MaturingStrategies/ConjuredMaturingStrategyTests.cs new file mode 100644 index 0000000..639684c --- /dev/null +++ b/tests/Core.Tests/ProposedCode/MaturingStrategies/ConjuredMaturingStrategyTests.cs @@ -0,0 +1,63 @@ +//----------------------------------------------------------------------- +// +// Copyright (c) KsiProgramming. All rights reserved. +// +//----------------------------------------------------------------------- + +namespace GildedRoseKata.ProposedCode.MaturingStrategies.Tests; + +using FluentAssertions; + +public class ConjuredMaturingStrategyTests +{ + [Fact] + public void Update() + { + var request = new ItemMaturingRequest + { + quality = new (0), + sellIn = new (5), + }; + + var strategy = new ConjuredMaturingStrategy(); + + var result = strategy.Update(request); + + result.quality.value.Should().Be(0); + result.sellIn.value.Should().Be(4); + } + + [Fact] + public void Update_WithQualityIsAboveMinimum() + { + var request = new ItemMaturingRequest + { + quality = new (5), + sellIn = new (5), + }; + + var strategy = new ConjuredMaturingStrategy(); + + var result = strategy.Update(request); + + result.quality.value.Should().Be(3); + result.sellIn.value.Should().Be(4); + } + + [Fact] + public void Update_WithQualityIsAboveMinimumAndSellInIsExpired() + { + var request = new ItemMaturingRequest + { + quality = new (5), + sellIn = new (1), + }; + + var strategy = new ConjuredMaturingStrategy(); + + var result = strategy.Update(request); + + result.quality.value.Should().Be(1); + result.sellIn.value.Should().Be(0); + } +}