Skip to content

Commit

Permalink
Add tests for Update of ConjuredMaturingStrategy
Browse files Browse the repository at this point in the history
  • Loading branch information
KsiProgramming committed Jul 6, 2024
1 parent 7633672 commit 8fa4a91
Showing 1 changed file with 63 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
//-----------------------------------------------------------------------
// <copyright file="ConjuredMaturingStrategyTests.cs" company="KsiProgramming">
// Copyright (c) KsiProgramming. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------

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);
}
}

0 comments on commit 8fa4a91

Please sign in to comment.