summaryrefslogtreecommitdiff
path: root/src/StardewModdingAPI.Tests
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2017-09-06 22:04:51 -0400
committerJesse Plamondon-Willard <github@jplamondonw.com>2017-09-06 22:04:51 -0400
commitb2b3df08bcd2de9c9f9ca98f61a50f4c6d1fd6e5 (patch)
tree4b0a08423249bcb1b6bd3da33901014c607637e5 /src/StardewModdingAPI.Tests
parentd971514a3d316e1466db51f9709635ce6d4e6b91 (diff)
downloadSMAPI-b2b3df08bcd2de9c9f9ca98f61a50f4c6d1fd6e5.tar.gz
SMAPI-b2b3df08bcd2de9c9f9ca98f61a50f4c6d1fd6e5.tar.bz2
SMAPI-b2b3df08bcd2de9c9f9ca98f61a50f4c6d1fd6e5.zip
rewrite date calculation to handle edge cases
Diffstat (limited to 'src/StardewModdingAPI.Tests')
-rw-r--r--src/StardewModdingAPI.Tests/Utilities/SDateTests.cs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/StardewModdingAPI.Tests/Utilities/SDateTests.cs b/src/StardewModdingAPI.Tests/Utilities/SDateTests.cs
index 714756e0..25acbaf3 100644
--- a/src/StardewModdingAPI.Tests/Utilities/SDateTests.cs
+++ b/src/StardewModdingAPI.Tests/Utilities/SDateTests.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
@@ -104,6 +104,8 @@ namespace StardewModdingAPI.Tests.Utilities
[TestCase("15 summer Y1", -28, ExpectedResult = "15 spring Y1")] // negative season transition
[TestCase("15 summer Y2", -28 * 4, ExpectedResult = "15 summer Y1")] // negative year transition
[TestCase("01 spring Y3", -(28 * 7 + 17), ExpectedResult = "12 spring Y1")] // negative year transition
+ [TestCase("06 fall Y2", 50, ExpectedResult = "28 winter Y3")] // test for zero-index errors
+ [TestCase("06 fall Y2", 51, ExpectedResult = "01 spring Y3")] // test for zero-index errors
public string AddDays(string dateStr, int addDays)
{
return this.GetDate(dateStr).AddDays(addDays).ToString();