summaryrefslogtreecommitdiff
path: root/src/SMAPI.Tests
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2018-01-24 11:44:28 -0500
committerJesse Plamondon-Willard <github@jplamondonw.com>2018-01-24 11:44:28 -0500
commit0da5dab8932c53ba39f2290268294e9a72b9c5bb (patch)
tree9302a2a53a68202ac97e86662394a509df499541 /src/SMAPI.Tests
parent15d4b6310e3dd15c62f3faedbf1290b2db26fb59 (diff)
parent5c96a10da5801049ee17ffa185dbf19e6d8a2306 (diff)
downloadSMAPI-0da5dab8932c53ba39f2290268294e9a72b9c5bb.tar.gz
SMAPI-0da5dab8932c53ba39f2290268294e9a72b9c5bb.tar.bz2
SMAPI-0da5dab8932c53ba39f2290268294e9a72b9c5bb.zip
Merge branch 'develop' into stable
Diffstat (limited to 'src/SMAPI.Tests')
-rw-r--r--src/SMAPI.Tests/StardewModdingAPI.Tests.csproj4
-rw-r--r--src/SMAPI.Tests/Utilities/SemanticVersionTests.cs17
-rw-r--r--src/SMAPI.Tests/packages.config2
3 files changed, 20 insertions, 3 deletions
diff --git a/src/SMAPI.Tests/StardewModdingAPI.Tests.csproj b/src/SMAPI.Tests/StardewModdingAPI.Tests.csproj
index c7a67306..6e7fa1f0 100644
--- a/src/SMAPI.Tests/StardewModdingAPI.Tests.csproj
+++ b/src/SMAPI.Tests/StardewModdingAPI.Tests.csproj
@@ -36,8 +36,8 @@
<Reference Include="Moq, Version=4.7.142.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<HintPath>..\packages\Moq.4.7.142\lib\net45\Moq.dll</HintPath>
</Reference>
- <Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
- <HintPath>..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
+ <Reference Include="Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+ <HintPath>..\packages\Newtonsoft.Json.11.0.1-beta3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="nunit.framework, Version=3.8.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.3.8.1\lib\net45\nunit.framework.dll</HintPath>
diff --git a/src/SMAPI.Tests/Utilities/SemanticVersionTests.cs b/src/SMAPI.Tests/Utilities/SemanticVersionTests.cs
index d3e0988e..f1a72012 100644
--- a/src/SMAPI.Tests/Utilities/SemanticVersionTests.cs
+++ b/src/SMAPI.Tests/Utilities/SemanticVersionTests.cs
@@ -33,6 +33,7 @@ namespace StardewModdingAPI.Tests.Utilities
[TestCase(3000, 4000, 5000, null, ExpectedResult = "3000.4000.5000")]
[TestCase(1, 2, 3, "", ExpectedResult = "1.2.3")]
[TestCase(1, 2, 3, " ", ExpectedResult = "1.2.3")]
+ [TestCase(1, 2, 3, "0", ExpectedResult = "1.2.3-0")]
[TestCase(1, 2, 3, "some-tag.4", ExpectedResult = "1.2.3-some-tag.4")]
[TestCase(1, 2, 3, "some-tag.4 ", ExpectedResult = "1.2.3-some-tag.4")]
public string Constructor_FromParts(int major, int minor, int patch, string tag)
@@ -270,6 +271,22 @@ namespace StardewModdingAPI.Tests.Utilities
Assert.IsTrue(version.IsOlderThan(new SemanticVersion("1.2.30")), "The game version should be considered older than the later semantic versions.");
}
+ /****
+ ** LegacyManifestVersion
+ ****/
+ [Test(Description = "Assert that the LegacyManifestVersion subclass correctly parses legacy manifest versions.")]
+ [TestCase(1, 0, 0, null, ExpectedResult = "1.0")]
+ [TestCase(3000, 4000, 5000, null, ExpectedResult = "3000.4000.5000")]
+ [TestCase(1, 2, 3, "", ExpectedResult = "1.2.3")]
+ [TestCase(1, 2, 3, " ", ExpectedResult = "1.2.3")]
+ [TestCase(1, 2, 3, "0", ExpectedResult = "1.2.3")] // special case: drop '0' tag for legacy manifest versions
+ [TestCase(1, 2, 3, "some-tag.4", ExpectedResult = "1.2.3-some-tag.4")]
+ [TestCase(1, 2, 3, "some-tag.4 ", ExpectedResult = "1.2.3-some-tag.4")]
+ public string LegacyManifestVersion(int major, int minor, int patch, string tag)
+ {
+ return new LegacyManifestVersion(major, minor, patch, tag).ToString();
+ }
+
/*********
** Private methods
diff --git a/src/SMAPI.Tests/packages.config b/src/SMAPI.Tests/packages.config
index 7a91e807..498325d6 100644
--- a/src/SMAPI.Tests/packages.config
+++ b/src/SMAPI.Tests/packages.config
@@ -2,6 +2,6 @@
<packages>
<package id="Castle.Core" version="4.2.1" targetFramework="net45" />
<package id="Moq" version="4.7.142" targetFramework="net45" />
- <package id="Newtonsoft.Json" version="10.0.3" targetFramework="net45" />
+ <package id="Newtonsoft.Json" version="11.0.1-beta3" targetFramework="net45" />
<package id="NUnit" version="3.8.1" targetFramework="net45" />
</packages> \ No newline at end of file