summaryrefslogtreecommitdiff
path: root/src/SMAPI.Tests
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-01-29 18:15:42 -0500
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-01-29 18:15:42 -0500
commit3431f486a2ef93e86d8923c1a4651644110df81b (patch)
tree8920ca74486930f3841666206acd1b992040cebf /src/SMAPI.Tests
parent6dd4a8a12b25d349b18609132dade14da6ec3cf9 (diff)
downloadSMAPI-3431f486a2ef93e86d8923c1a4651644110df81b.tar.gz
SMAPI-3431f486a2ef93e86d8923c1a4651644110df81b.tar.bz2
SMAPI-3431f486a2ef93e86d8923c1a4651644110df81b.zip
normalize season names in SDate constructor
Diffstat (limited to 'src/SMAPI.Tests')
-rw-r--r--src/SMAPI.Tests/Utilities/SDateTests.cs10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/SMAPI.Tests/Utilities/SDateTests.cs b/src/SMAPI.Tests/Utilities/SDateTests.cs
index 0461952e..374f4921 100644
--- a/src/SMAPI.Tests/Utilities/SDateTests.cs
+++ b/src/SMAPI.Tests/Utilities/SDateTests.cs
@@ -16,9 +16,12 @@ namespace SMAPI.Tests.Utilities
/*********
** Fields
*********/
- /// <summary>All valid seasons.</summary>
+ /// <summary>The valid seasons.</summary>
private static readonly string[] ValidSeasons = { "spring", "summer", "fall", "winter" };
+ /// <summary>Sample user inputs for season names.</summary>
+ private static readonly string[] SampleSeasonValues = SDateTests.ValidSeasons.Concat(new[] { " WIntEr " }).ToArray();
+
/// <summary>All valid days of a month.</summary>
private static readonly int[] ValidDays = Enumerable.Range(1, 28).ToArray();
@@ -55,19 +58,18 @@ namespace SMAPI.Tests.Utilities
** Constructor
****/
[Test(Description = "Assert that the constructor sets the expected values for all valid dates.")]
- public void Constructor_SetsExpectedValues([ValueSource(nameof(SDateTests.ValidSeasons))] string season, [ValueSource(nameof(SDateTests.ValidDays))] int day, [Values(1, 2, 100)] int year)
+ public void Constructor_SetsExpectedValues([ValueSource(nameof(SDateTests.SampleSeasonValues))] string season, [ValueSource(nameof(SDateTests.ValidDays))] int day, [Values(1, 2, 100)] int year)
{
// act
SDate date = new SDate(day, season, year);
// assert
Assert.AreEqual(day, date.Day);
- Assert.AreEqual(season, date.Season);
+ Assert.AreEqual(season.Trim().ToLowerInvariant(), date.Season);
Assert.AreEqual(year, date.Year);
}
[Test(Description = "Assert that the constructor throws an exception if the values are invalid.")]
- [TestCase(01, "Spring", 1)] // seasons are case-sensitive
[TestCase(01, "springs", 1)] // invalid season name
[TestCase(-1, "spring", 1)] // day < 0
[TestCase(0, "spring", 1)] // day zero