-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for Update of ConjuredMaturingStrategy
- Loading branch information
1 parent
7633672
commit 8fa4a91
Showing
1 changed file
with
63 additions
and
0 deletions.
There are no files selected for viewing
63 changes: 63 additions & 0 deletions
63
tests/Core.Tests/ProposedCode/MaturingStrategies/ConjuredMaturingStrategyTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |