summaryrefslogtreecommitdiff
path: root/src/SMAPI.Tests/Utilities/SDateTests.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2017-12-02 18:49:49 -0500
committerJesse Plamondon-Willard <github@jplamondonw.com>2017-12-02 18:49:49 -0500
commit5cc5f089b9645a60385ff293b5a7202f260bfc0f (patch)
tree68f8bee734d164277f711b8ac54bd1064c0757d6 /src/SMAPI.Tests/Utilities/SDateTests.cs
parente0b72374cd14298aacc6f71dc391fdc9814be37c (diff)
parentdc4f89acb6cd8f838934b60e8f5645c6145706f8 (diff)
downloadSMAPI-5cc5f089b9645a60385ff293b5a7202f260bfc0f.tar.gz
SMAPI-5cc5f089b9645a60385ff293b5a7202f260bfc0f.tar.bz2
SMAPI-5cc5f089b9645a60385ff293b5a7202f260bfc0f.zip
Merge branch 'develop' into stable
Diffstat (limited to 'src/SMAPI.Tests/Utilities/SDateTests.cs')
-rw-r--r--src/SMAPI.Tests/Utilities/SDateTests.cs53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/SMAPI.Tests/Utilities/SDateTests.cs b/src/SMAPI.Tests/Utilities/SDateTests.cs
index 86a0d3d0..b89d8857 100644
--- a/src/SMAPI.Tests/Utilities/SDateTests.cs
+++ b/src/SMAPI.Tests/Utilities/SDateTests.cs
@@ -82,6 +82,59 @@ namespace StardewModdingAPI.Tests.Utilities
}
/****
+ ** DayOfWeek
+ ****/
+ [Test(Description = "Assert the day of week.")]
+ [TestCase("01 spring Y1", ExpectedResult = System.DayOfWeek.Monday)]
+ [TestCase("02 spring Y2", ExpectedResult = System.DayOfWeek.Tuesday)]
+ [TestCase("03 spring Y3", ExpectedResult = System.DayOfWeek.Wednesday)]
+ [TestCase("04 spring Y4", ExpectedResult = System.DayOfWeek.Thursday)]
+ [TestCase("05 spring Y5", ExpectedResult = System.DayOfWeek.Friday)]
+ [TestCase("06 spring Y6", ExpectedResult = System.DayOfWeek.Saturday)]
+ [TestCase("07 spring Y7", ExpectedResult = System.DayOfWeek.Sunday)]
+ [TestCase("08 summer Y8", ExpectedResult = System.DayOfWeek.Monday)]
+ [TestCase("09 summer Y9", ExpectedResult = System.DayOfWeek.Tuesday)]
+ [TestCase("10 summer Y10", ExpectedResult = System.DayOfWeek.Wednesday)]
+ [TestCase("11 summer Y11", ExpectedResult = System.DayOfWeek.Thursday)]
+ [TestCase("12 summer Y12", ExpectedResult = System.DayOfWeek.Friday)]
+ [TestCase("13 summer Y13", ExpectedResult = System.DayOfWeek.Saturday)]
+ [TestCase("14 summer Y14", ExpectedResult = System.DayOfWeek.Sunday)]
+ [TestCase("15 fall Y15", ExpectedResult = System.DayOfWeek.Monday)]
+ [TestCase("16 fall Y16", ExpectedResult = System.DayOfWeek.Tuesday)]
+ [TestCase("17 fall Y17", ExpectedResult = System.DayOfWeek.Wednesday)]
+ [TestCase("18 fall Y18", ExpectedResult = System.DayOfWeek.Thursday)]
+ [TestCase("19 fall Y19", ExpectedResult = System.DayOfWeek.Friday)]
+ [TestCase("20 fall Y20", ExpectedResult = System.DayOfWeek.Saturday)]
+ [TestCase("21 fall Y21", ExpectedResult = System.DayOfWeek.Sunday)]
+ [TestCase("22 winter Y22", ExpectedResult = System.DayOfWeek.Monday)]
+ [TestCase("23 winter Y23", ExpectedResult = System.DayOfWeek.Tuesday)]
+ [TestCase("24 winter Y24", ExpectedResult = System.DayOfWeek.Wednesday)]
+ [TestCase("25 winter Y25", ExpectedResult = System.DayOfWeek.Thursday)]
+ [TestCase("26 winter Y26", ExpectedResult = System.DayOfWeek.Friday)]
+ [TestCase("27 winter Y27", ExpectedResult = System.DayOfWeek.Saturday)]
+ [TestCase("28 winter Y28" + "", ExpectedResult = System.DayOfWeek.Sunday)]
+ public DayOfWeek DayOfWeek(string dateStr)
+ {
+ // act
+ return this.GetDate(dateStr).DayOfWeek;
+ }
+
+ /****
+ ** DaysSinceStart
+ ****/
+ [Test(Description = "Assert the number of days since 01 spring Y1 (inclusive).")]
+ [TestCase("01 spring Y1", ExpectedResult = 1)]
+ [TestCase("02 spring Y1", ExpectedResult = 2)]
+ [TestCase("28 spring Y1", ExpectedResult = 28)]
+ [TestCase("01 summer Y1", ExpectedResult = 29)]
+ [TestCase("01 summer Y2", ExpectedResult = 141)]
+ public int DaysSinceStart(string dateStr)
+ {
+ // act
+ return this.GetDate(dateStr).DaysSinceStart;
+ }
+
+ /****
** ToString
****/
[Test(Description = "Assert that ToString returns the expected string.")]