summaryrefslogtreecommitdiff
path: root/src/SMAPI.Tests
diff options
context:
space:
mode:
Diffstat (limited to 'src/SMAPI.Tests')
-rw-r--r--src/SMAPI.Tests/Core/ModResolverTests.cs30
-rw-r--r--src/SMAPI.Tests/Core/TranslationTests.cs54
-rw-r--r--src/SMAPI.Tests/Properties/AssemblyInfo.cs4
-rw-r--r--src/SMAPI.Tests/SMAPI.Tests.csproj37
-rw-r--r--src/SMAPI.Tests/Sample.cs2
-rw-r--r--src/SMAPI.Tests/StardewModdingAPI.Tests.csproj40
-rw-r--r--src/SMAPI.Tests/Toolkit/PathUtilitiesTests.cs8
-rw-r--r--src/SMAPI.Tests/Utilities/SDateTests.cs4
-rw-r--r--src/SMAPI.Tests/Utilities/SemanticVersionTests.cs23
9 files changed, 96 insertions, 106 deletions
diff --git a/src/SMAPI.Tests/Core/ModResolverTests.cs b/src/SMAPI.Tests/Core/ModResolverTests.cs
index 4a1f04c6..a9c88c60 100644
--- a/src/SMAPI.Tests/Core/ModResolverTests.cs
+++ b/src/SMAPI.Tests/Core/ModResolverTests.cs
@@ -5,13 +5,15 @@ using System.Linq;
using Moq;
using Newtonsoft.Json;
using NUnit.Framework;
+using StardewModdingAPI;
using StardewModdingAPI.Framework;
using StardewModdingAPI.Framework.ModLoading;
using StardewModdingAPI.Toolkit;
using StardewModdingAPI.Toolkit.Framework.ModData;
-using StardewModdingAPI.Toolkit.Serialisation.Models;
+using StardewModdingAPI.Toolkit.Serialization.Models;
+using SemanticVersion = StardewModdingAPI.SemanticVersion;
-namespace StardewModdingAPI.Tests.Core
+namespace SMAPI.Tests.Core
{
/// <summary>Unit tests for <see cref="ModResolver"/>.</summary>
[TestFixture]
@@ -27,7 +29,7 @@ namespace StardewModdingAPI.Tests.Core
public void ReadBasicManifest_NoMods_ReturnsEmptyList()
{
// arrange
- string rootFolder = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString("N"));
+ string rootFolder = this.GetTempFolderPath();
Directory.CreateDirectory(rootFolder);
// act
@@ -41,7 +43,7 @@ namespace StardewModdingAPI.Tests.Core
public void ReadBasicManifest_EmptyModFolder_ReturnsFailedManifest()
{
// arrange
- string rootFolder = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString("N"));
+ string rootFolder = this.GetTempFolderPath();
string modFolder = Path.Combine(rootFolder, Guid.NewGuid().ToString("N"));
Directory.CreateDirectory(modFolder);
@@ -55,7 +57,7 @@ namespace StardewModdingAPI.Tests.Core
Assert.IsNotNull(mod.Error, "The mod metadata did not have an error message set.");
}
- [Test(Description = "Assert that the resolver correctly reads manifest data from a randomised file.")]
+ [Test(Description = "Assert that the resolver correctly reads manifest data from a randomized file.")]
public void ReadBasicManifest_CanReadFile()
{
// create manifest data
@@ -78,7 +80,7 @@ namespace StardewModdingAPI.Tests.Core
};
// write to filesystem
- string rootFolder = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString("N"));
+ string rootFolder = this.GetTempFolderPath();
string modFolder = Path.Combine(rootFolder, Guid.NewGuid().ToString("N"));
string filename = Path.Combine(modFolder, "manifest.json");
Directory.CreateDirectory(modFolder);
@@ -209,7 +211,7 @@ namespace StardewModdingAPI.Tests.Core
IManifest manifest = this.GetManifest();
// create DLL
- string modFolder = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString("N"));
+ string modFolder = Path.Combine(this.GetTempFolderPath(), Guid.NewGuid().ToString("N"));
Directory.CreateDirectory(modFolder);
File.WriteAllText(Path.Combine(modFolder, manifest.EntryDll), "");
@@ -462,7 +464,13 @@ namespace StardewModdingAPI.Tests.Core
/*********
** Private methods
*********/
- /// <summary>Get a randomised basic manifest.</summary>
+ /// <summary>Get a generated folder path in the temp folder. This folder isn't created automatically.</summary>
+ private string GetTempFolderPath()
+ {
+ return Path.Combine(Path.GetTempPath(), "smapi-unit-tests", Guid.NewGuid().ToString("N"));
+ }
+
+ /// <summary>Get a randomized basic manifest.</summary>
/// <param name="id">The <see cref="IManifest.UniqueID"/> value, or <c>null</c> for a generated value.</param>
/// <param name="name">The <see cref="IManifest.Name"/> value, or <c>null</c> for a generated value.</param>
/// <param name="version">The <see cref="IManifest.Version"/> value, or <c>null</c> for a generated value.</param>
@@ -486,14 +494,14 @@ namespace StardewModdingAPI.Tests.Core
};
}
- /// <summary>Get a randomised basic manifest.</summary>
+ /// <summary>Get a randomized basic manifest.</summary>
/// <param name="uniqueID">The mod's name and unique ID.</param>
private Mock<IModMetadata> GetMetadata(string uniqueID)
{
return this.GetMetadata(this.GetManifest(uniqueID, "1.0"));
}
- /// <summary>Get a randomised basic manifest.</summary>
+ /// <summary>Get a randomized basic manifest.</summary>
/// <param name="uniqueID">The mod's name and unique ID.</param>
/// <param name="dependencies">The dependencies this mod requires.</param>
/// <param name="allowStatusChange">Whether the code being tested is allowed to change the mod status.</param>
@@ -503,7 +511,7 @@ namespace StardewModdingAPI.Tests.Core
return this.GetMetadata(manifest, allowStatusChange);
}
- /// <summary>Get a randomised basic manifest.</summary>
+ /// <summary>Get a randomized basic manifest.</summary>
/// <param name="manifest">The mod manifest.</param>
/// <param name="allowStatusChange">Whether the code being tested is allowed to change the mod status.</param>
private Mock<IModMetadata> GetMetadata(IManifest manifest, bool allowStatusChange = false)
diff --git a/src/SMAPI.Tests/Core/TranslationTests.cs b/src/SMAPI.Tests/Core/TranslationTests.cs
index 63404a41..457f9fad 100644
--- a/src/SMAPI.Tests/Core/TranslationTests.cs
+++ b/src/SMAPI.Tests/Core/TranslationTests.cs
@@ -2,10 +2,11 @@ using System;
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
+using StardewModdingAPI;
using StardewModdingAPI.Framework.ModHelpers;
using StardewValley;
-namespace StardewModdingAPI.Tests.Core
+namespace SMAPI.Tests.Core
{
/// <summary>Unit tests for <see cref="TranslationHelper"/> and <see cref="Translation"/>.</summary>
[TestFixture]
@@ -31,7 +32,7 @@ namespace StardewModdingAPI.Tests.Core
var data = new Dictionary<string, IDictionary<string, string>>();
// act
- ITranslationHelper helper = new TranslationHelper("ModID", "ModName", "en", LocalizedContentManager.LanguageCode.en).SetTranslations(data);
+ ITranslationHelper helper = new TranslationHelper("ModID", "en", LocalizedContentManager.LanguageCode.en).SetTranslations(data);
Translation translation = helper.Get("key");
Translation[] translationList = helper.GetTranslations()?.ToArray();
@@ -54,7 +55,7 @@ namespace StardewModdingAPI.Tests.Core
// act
var actual = new Dictionary<string, Translation[]>();
- TranslationHelper helper = new TranslationHelper("ModID", "ModName", "en", LocalizedContentManager.LanguageCode.en).SetTranslations(data);
+ TranslationHelper helper = new TranslationHelper("ModID", "en", LocalizedContentManager.LanguageCode.en).SetTranslations(data);
foreach (string locale in expected.Keys)
{
this.AssertSetLocale(helper, locale, LocalizedContentManager.LanguageCode.en);
@@ -78,7 +79,7 @@ namespace StardewModdingAPI.Tests.Core
// act
var actual = new Dictionary<string, Translation[]>();
- TranslationHelper helper = new TranslationHelper("ModID", "ModName", "en", LocalizedContentManager.LanguageCode.en).SetTranslations(data);
+ TranslationHelper helper = new TranslationHelper("ModID", "en", LocalizedContentManager.LanguageCode.en).SetTranslations(data);
foreach (string locale in expected.Keys)
{
this.AssertSetLocale(helper, locale, LocalizedContentManager.LanguageCode.en);
@@ -108,14 +109,14 @@ namespace StardewModdingAPI.Tests.Core
[TestCase(" boop ", ExpectedResult = true)]
public bool Translation_HasValue(string text)
{
- return new Translation("ModName", "pt-BR", "key", text).HasValue();
+ return new Translation("pt-BR", "key", text).HasValue();
}
[Test(Description = "Assert that the translation's ToString method returns the expected text for various inputs.")]
public void Translation_ToString([ValueSource(nameof(TranslationTests.Samples))] string text)
{
// act
- Translation translation = new Translation("ModName", "pt-BR", "key", text);
+ Translation translation = new Translation("pt-BR", "key", text);
// assert
if (translation.HasValue())
@@ -128,7 +129,7 @@ namespace StardewModdingAPI.Tests.Core
public void Translation_ImplicitStringConversion([ValueSource(nameof(TranslationTests.Samples))] string text)
{
// act
- Translation translation = new Translation("ModName", "pt-BR", "key", text);
+ Translation translation = new Translation("pt-BR", "key", text);
// assert
if (translation.HasValue())
@@ -141,7 +142,7 @@ namespace StardewModdingAPI.Tests.Core
public void Translation_UsePlaceholder([Values(true, false)] bool value, [ValueSource(nameof(TranslationTests.Samples))] string text)
{
// act
- Translation translation = new Translation("ModName", "pt-BR", "key", text).UsePlaceholder(value);
+ Translation translation = new Translation("pt-BR", "key", text).UsePlaceholder(value);
// assert
if (translation.HasValue())
@@ -152,24 +153,11 @@ namespace StardewModdingAPI.Tests.Core
Assert.AreEqual(this.GetPlaceholderText("key"), translation.ToString(), "The translation returned an unexpected value given a null or empty input with the placeholder enabled.");
}
- [Test(Description = "Assert that the translation's Assert method throws the expected exception.")]
- public void Translation_Assert([ValueSource(nameof(TranslationTests.Samples))] string text)
- {
- // act
- Translation translation = new Translation("ModName", "pt-BR", "key", text);
-
- // assert
- if (translation.HasValue())
- Assert.That(() => translation.Assert(), Throws.Nothing, "The assert unexpected threw an exception for a valid input.");
- else
- Assert.That(() => translation.Assert(), Throws.Exception.TypeOf<KeyNotFoundException>(), "The assert didn't throw an exception for invalid input.");
- }
-
[Test(Description = "Assert that the translation returns the expected text after setting the default.")]
public void Translation_Default([ValueSource(nameof(TranslationTests.Samples))] string text, [ValueSource(nameof(TranslationTests.Samples))] string @default)
{
// act
- Translation translation = new Translation("ModName", "pt-BR", "key", text).Default(@default);
+ Translation translation = new Translation("pt-BR", "key", text).Default(@default);
// assert
if (!string.IsNullOrEmpty(text))
@@ -194,7 +182,7 @@ namespace StardewModdingAPI.Tests.Core
string expected = $"{start} tokens are properly replaced (including {middle} {middle}) {end}";
// act
- Translation translation = new Translation("ModName", "pt-BR", "key", input);
+ Translation translation = new Translation("pt-BR", "key", input);
switch (structure)
{
case "anonymous object":
@@ -235,7 +223,7 @@ namespace StardewModdingAPI.Tests.Core
string value = Guid.NewGuid().ToString("N");
// act
- Translation translation = new Translation("ModName", "pt-BR", "key", text).Tokens(new Dictionary<string, object> { [key] = value });
+ Translation translation = new Translation("pt-BR", "key", text).Tokens(new Dictionary<string, object> { [key] = value });
// assert
Assert.AreEqual(value, translation.ToString(), "The translation returned an unexpected value given a valid base text.");
@@ -245,13 +233,13 @@ namespace StardewModdingAPI.Tests.Core
[TestCase("{{value}}", "value")]
[TestCase("{{VaLuE}}", "vAlUe")]
[TestCase("{{VaLuE }}", " vAlUe")]
- public void Translation_Tokens_KeysAreNormalised(string text, string key)
+ public void Translation_Tokens_KeysAreNormalized(string text, string key)
{
// arrange
string value = Guid.NewGuid().ToString("N");
// act
- Translation translation = new Translation("ModName", "pt-BR", "key", text).Tokens(new Dictionary<string, object> { [key] = value });
+ Translation translation = new Translation("pt-BR", "key", text).Tokens(new Dictionary<string, object> { [key] = value });
// assert
Assert.AreEqual(value, translation.ToString(), "The translation returned an unexpected value given a valid base text.");
@@ -302,19 +290,19 @@ namespace StardewModdingAPI.Tests.Core
{
["default"] = new[]
{
- new Translation(string.Empty, "default", "key A", "default A"),
- new Translation(string.Empty, "default", "key C", "default C")
+ new Translation("default", "key A", "default A"),
+ new Translation("default", "key C", "default C")
},
["en"] = new[]
{
- new Translation(string.Empty, "en", "key A", "en A"),
- new Translation(string.Empty, "en", "key B", "en B"),
- new Translation(string.Empty, "en", "key C", "default C")
+ new Translation("en", "key A", "en A"),
+ new Translation("en", "key B", "en B"),
+ new Translation("en", "key C", "default C")
},
["zzz"] = new[]
{
- new Translation(string.Empty, "zzz", "key A", "zzz A"),
- new Translation(string.Empty, "zzz", "key C", "default C")
+ new Translation("zzz", "key A", "zzz A"),
+ new Translation("zzz", "key C", "default C")
}
};
expected["en-us"] = expected["en"].ToArray();
diff --git a/src/SMAPI.Tests/Properties/AssemblyInfo.cs b/src/SMAPI.Tests/Properties/AssemblyInfo.cs
deleted file mode 100644
index 8b21e8fe..00000000
--- a/src/SMAPI.Tests/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,4 +0,0 @@
-using System.Reflection;
-
-[assembly: AssemblyTitle("SMAPI.Tests")]
-[assembly: AssemblyDescription("")]
diff --git a/src/SMAPI.Tests/SMAPI.Tests.csproj b/src/SMAPI.Tests/SMAPI.Tests.csproj
new file mode 100644
index 00000000..639c22a4
--- /dev/null
+++ b/src/SMAPI.Tests/SMAPI.Tests.csproj
@@ -0,0 +1,37 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+ <PropertyGroup>
+ <AssemblyName>SMAPI.Tests</AssemblyName>
+ <RootNamespace>SMAPI.Tests</RootNamespace>
+ <TargetFramework>net45</TargetFramework>
+ <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
+ <LangVersion>latest</LangVersion>
+ <PlatformTarget>x86</PlatformTarget>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <ProjectReference Include="..\SMAPI.Toolkit.CoreInterfaces\SMAPI.Toolkit.CoreInterfaces.csproj" />
+ <ProjectReference Include="..\SMAPI.Toolkit\SMAPI.Toolkit.csproj" />
+ <ProjectReference Include="..\SMAPI\SMAPI.csproj" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <PackageReference Include="Moq" Version="4.13.1" />
+ <PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
+ <PackageReference Include="NUnit" Version="3.12.0" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <Reference Include="$(GameExecutableName)">
+ <HintPath>$(GamePath)\$(GameExecutableName).exe</HintPath>
+ <Private>True</Private>
+ </Reference>
+ </ItemGroup>
+
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+
+ <Import Project="..\..\build\common.targets" />
+
+</Project>
diff --git a/src/SMAPI.Tests/Sample.cs b/src/SMAPI.Tests/Sample.cs
index 6cd27707..f4f0d88e 100644
--- a/src/SMAPI.Tests/Sample.cs
+++ b/src/SMAPI.Tests/Sample.cs
@@ -1,6 +1,6 @@
using System;
-namespace StardewModdingAPI.Tests
+namespace SMAPI.Tests
{
/// <summary>Provides sample values for unit testing.</summary>
internal static class Sample
diff --git a/src/SMAPI.Tests/StardewModdingAPI.Tests.csproj b/src/SMAPI.Tests/StardewModdingAPI.Tests.csproj
deleted file mode 100644
index 1cb2d1e6..00000000
--- a/src/SMAPI.Tests/StardewModdingAPI.Tests.csproj
+++ /dev/null
@@ -1,40 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk">
-
- <PropertyGroup>
- <RootNamespace>StardewModdingAPI.Tests</RootNamespace>
- <AssemblyName>StardewModdingAPI.Tests</AssemblyName>
- <TargetFramework>net45</TargetFramework>
- <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
- <LangVersion>latest</LangVersion>
- <PlatformTarget>x86</PlatformTarget>
- </PropertyGroup>
-
- <ItemGroup>
- <ProjectReference Include="..\SMAPI.Toolkit.CoreInterfaces\StardewModdingAPI.Toolkit.CoreInterfaces.csproj" />
- <ProjectReference Include="..\SMAPI.Toolkit\StardewModdingAPI.Toolkit.csproj" />
- <ProjectReference Include="..\SMAPI\StardewModdingAPI.csproj" />
- </ItemGroup>
-
- <ItemGroup>
- <PackageReference Include="Castle.Core" Version="4.3.1" />
- <PackageReference Include="Moq" Version="4.10.0" />
- <PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
- <PackageReference Include="NUnit" Version="3.11.0" />
- <PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.5.2" />
- <PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.1" />
- <PackageReference Include="System.ValueTuple" Version="4.5.0" />
- </ItemGroup>
-
- <ItemGroup>
- <Compile Include="..\..\build\GlobalAssemblyInfo.cs">
- <Link>Properties\GlobalAssemblyInfo.cs</Link>
- </Compile>
- </ItemGroup>
-
- <ItemGroup>
- <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
- </ItemGroup>
-
- <Import Project="..\..\build\common.targets" />
-
-</Project>
diff --git a/src/SMAPI.Tests/Toolkit/PathUtilitiesTests.cs b/src/SMAPI.Tests/Toolkit/PathUtilitiesTests.cs
index 229b9a14..55785bfa 100644
--- a/src/SMAPI.Tests/Toolkit/PathUtilitiesTests.cs
+++ b/src/SMAPI.Tests/Toolkit/PathUtilitiesTests.cs
@@ -1,7 +1,7 @@
using NUnit.Framework;
using StardewModdingAPI.Toolkit.Utilities;
-namespace StardewModdingAPI.Tests.Toolkit
+namespace SMAPI.Tests.Toolkit
{
/// <summary>Unit tests for <see cref="PathUtilities"/>.</summary>
[TestFixture]
@@ -25,7 +25,7 @@ namespace StardewModdingAPI.Tests.Toolkit
return string.Join("|", PathUtilities.GetSegments(path));
}
- [Test(Description = "Assert that NormalisePathSeparators returns the expected values.")]
+ [Test(Description = "Assert that NormalizePathSeparators returns the expected values.")]
#if SMAPI_FOR_WINDOWS
[TestCase("", ExpectedResult = "")]
[TestCase("/", ExpectedResult = "")]
@@ -47,9 +47,9 @@ namespace StardewModdingAPI.Tests.Toolkit
[TestCase("C:/boop", ExpectedResult = "C:/boop")]
[TestCase(@"C:\usr\bin//.././boop.exe", ExpectedResult = "C:/usr/bin/.././boop.exe")]
#endif
- public string NormalisePathSeparators(string path)
+ public string NormalizePathSeparators(string path)
{
- return PathUtilities.NormalisePathSeparators(path);
+ return PathUtilities.NormalizePathSeparators(path);
}
[Test(Description = "Assert that GetRelativePath returns the expected values.")]
diff --git a/src/SMAPI.Tests/Utilities/SDateTests.cs b/src/SMAPI.Tests/Utilities/SDateTests.cs
index 1f31168e..d25a101a 100644
--- a/src/SMAPI.Tests/Utilities/SDateTests.cs
+++ b/src/SMAPI.Tests/Utilities/SDateTests.cs
@@ -6,7 +6,7 @@ using System.Text.RegularExpressions;
using NUnit.Framework;
using StardewModdingAPI.Utilities;
-namespace StardewModdingAPI.Tests.Utilities
+namespace SMAPI.Tests.Utilities
{
/// <summary>Unit tests for <see cref="SDate"/>.</summary>
[TestFixture]
@@ -159,7 +159,7 @@ 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", 50, ExpectedResult = "28 winter Y2")] // 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)
{
diff --git a/src/SMAPI.Tests/Utilities/SemanticVersionTests.cs b/src/SMAPI.Tests/Utilities/SemanticVersionTests.cs
index 2e7719eb..c91ec27f 100644
--- a/src/SMAPI.Tests/Utilities/SemanticVersionTests.cs
+++ b/src/SMAPI.Tests/Utilities/SemanticVersionTests.cs
@@ -2,9 +2,10 @@ using System;
using System.Diagnostics.CodeAnalysis;
using Newtonsoft.Json;
using NUnit.Framework;
+using StardewModdingAPI;
using StardewModdingAPI.Framework;
-namespace StardewModdingAPI.Tests.Utilities
+namespace SMAPI.Tests.Utilities
{
/// <summary>Unit tests for <see cref="SemanticVersion"/>.</summary>
[TestFixture]
@@ -17,10 +18,10 @@ namespace StardewModdingAPI.Tests.Utilities
** Constructor
****/
[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("1.0", ExpectedResult = "1.0.0")]
+ [TestCase("1.0.0", ExpectedResult = "1.0.0")]
[TestCase("3000.4000.5000", ExpectedResult = "3000.4000.5000")]
- [TestCase("1.2-some-tag.4", ExpectedResult = "1.2-some-tag.4")]
+ [TestCase("1.2-some-tag.4", ExpectedResult = "1.2.0-some-tag.4")]
[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")]
[TestCase("1.2.3-some-tag.4 ", ExpectedResult = "1.2.3-some-tag.4")]
@@ -30,7 +31,7 @@ namespace StardewModdingAPI.Tests.Utilities
}
[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(1, 0, 0, null, ExpectedResult = "1.0.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")]
@@ -65,7 +66,7 @@ namespace StardewModdingAPI.Tests.Utilities
}
[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, 0, 0, ExpectedResult = "1.0.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)
@@ -243,19 +244,19 @@ namespace StardewModdingAPI.Tests.Utilities
}
/****
- ** Serialisable
+ ** Serializable
****/
[Test(Description = "Assert that SemanticVersion can be round-tripped through JSON with no special configuration.")]
- [TestCase("1.0")]
- public void Serialisable(string versionStr)
+ [TestCase("1.0.0")]
+ public void Serializable(string versionStr)
{
// act
string json = JsonConvert.SerializeObject(new SemanticVersion(versionStr));
SemanticVersion after = JsonConvert.DeserializeObject<SemanticVersion>(json);
// assert
- Assert.IsNotNull(after, "The semantic version after deserialisation is unexpectedly null.");
- Assert.AreEqual(versionStr, after.ToString(), "The semantic version after deserialisation doesn't match the input version.");
+ Assert.IsNotNull(after, "The semantic version after deserialization is unexpectedly null.");
+ Assert.AreEqual(versionStr, after.ToString(), "The semantic version after deserialization doesn't match the input version.");
}
/****