summaryrefslogtreecommitdiff
path: root/src/SMAPI.Tests/Utilities
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2017-11-01 17:42:18 -0400
committerJesse Plamondon-Willard <github@jplamondonw.com>2017-11-01 17:42:18 -0400
commite0b72374cd14298aacc6f71dc391fdc9814be37c (patch)
tree2e5d85937c34539c1a0df48423b5136508693ca8 /src/SMAPI.Tests/Utilities
parent79118316065a01322d8ea12a14589ec016794c32 (diff)
parent089e6de749ae7cb109af00164d2597c6644c255e (diff)
downloadSMAPI-e0b72374cd14298aacc6f71dc391fdc9814be37c.tar.gz
SMAPI-e0b72374cd14298aacc6f71dc391fdc9814be37c.tar.bz2
SMAPI-e0b72374cd14298aacc6f71dc391fdc9814be37c.zip
Merge branch 'develop' into stable
Diffstat (limited to 'src/SMAPI.Tests/Utilities')
-rw-r--r--src/SMAPI.Tests/Utilities/SemanticVersionTests.cs23
1 files changed, 20 insertions, 3 deletions
diff --git a/src/SMAPI.Tests/Utilities/SemanticVersionTests.cs b/src/SMAPI.Tests/Utilities/SemanticVersionTests.cs
index 03cd26c9..d3e0988e 100644
--- a/src/SMAPI.Tests/Utilities/SemanticVersionTests.cs
+++ b/src/SMAPI.Tests/Utilities/SemanticVersionTests.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Diagnostics.CodeAnalysis;
using Newtonsoft.Json;
using NUnit.Framework;
@@ -16,7 +16,7 @@ namespace StardewModdingAPI.Tests.Utilities
/****
** Constructor
****/
- [Test(Description = "Assert that the constructor sets the expected values for all valid versions.")]
+ [Test(Description = "Assert that the constructor sets the expected values for all valid versions when constructed from a string.")]
[TestCase("1.0", ExpectedResult = "1.0")]
[TestCase("1.0.0", ExpectedResult = "1.0")]
[TestCase("3000.4000.5000", ExpectedResult = "3000.4000.5000")]
@@ -28,7 +28,7 @@ namespace StardewModdingAPI.Tests.Utilities
return new SemanticVersion(input).ToString();
}
- [Test(Description = "Assert that the constructor sets the expected values for all valid versions.")]
+ [Test(Description = "Assert that the constructor sets the expected values for all valid versions when constructed from the individual numbers.")]
[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")]
@@ -48,6 +48,22 @@ namespace StardewModdingAPI.Tests.Utilities
return version.ToString();
}
+ [Test(Description = "Assert that the constructor sets the expected values for all valid versions when constructed from an assembly version.")]
+ [TestCase(1, 0, 0, ExpectedResult = "1.0")]
+ [TestCase(1, 2, 3, ExpectedResult = "1.2.3")]
+ [TestCase(3000, 4000, 5000, ExpectedResult = "3000.4000.5000")]
+ public string Constructor_FromAssemblyVersion(int major, int minor, int patch)
+ {
+ // act
+ ISemanticVersion version = new SemanticVersion(new Version(major, minor, patch));
+
+ // assert
+ Assert.AreEqual(major, version.MajorVersion, "The major version doesn't match the given value.");
+ Assert.AreEqual(minor, version.MinorVersion, "The minor version doesn't match the given value.");
+ Assert.AreEqual(patch, version.PatchVersion, "The patch version doesn't match the given value.");
+ return version.ToString();
+ }
+
[Test(Description = "Assert that the constructor throws the expected exception for invalid versions.")]
[TestCase(null)]
[TestCase("")]
@@ -239,6 +255,7 @@ namespace StardewModdingAPI.Tests.Utilities
[TestCase("1.06")]
[TestCase("1.07")]
[TestCase("1.07a")]
+ [TestCase("1.08")]
[TestCase("1.1")]
[TestCase("1.11")]
[TestCase("1.2")]