summaryrefslogtreecommitdiff
path: root/src/StardewModdingAPI.Tests
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2017-05-28 17:34:53 -0400
committerJesse Plamondon-Willard <github@jplamondonw.com>2017-05-28 17:34:53 -0400
commite20db6e8e4279dc95371e6f98c0e73dd19020c0f (patch)
treeb97d6f4650f4dead44f323e2230cdda27df918c4 /src/StardewModdingAPI.Tests
parent423a2f501249e237fe907cbe5e8568852b0710c5 (diff)
downloadSMAPI-e20db6e8e4279dc95371e6f98c0e73dd19020c0f.tar.gz
SMAPI-e20db6e8e4279dc95371e6f98c0e73dd19020c0f.tar.bz2
SMAPI-e20db6e8e4279dc95371e6f98c0e73dd19020c0f.zip
add token support for instance fields, expand unit test (#296)
Diffstat (limited to 'src/StardewModdingAPI.Tests')
-rw-r--r--src/StardewModdingAPI.Tests/TranslationTests.cs23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/StardewModdingAPI.Tests/TranslationTests.cs b/src/StardewModdingAPI.Tests/TranslationTests.cs
index a2fef2b7..6a430aa7 100644
--- a/src/StardewModdingAPI.Tests/TranslationTests.cs
+++ b/src/StardewModdingAPI.Tests/TranslationTests.cs
@@ -180,7 +180,7 @@ namespace StardewModdingAPI.Tests
** Translation tokens
****/
[Test(Description = "Assert that multiple translation tokens are replaced correctly regardless of the token structure.")]
- public void Translation_Tokens([Values("anonymous object", "IDictionary<string, object>", "IDictionary<string, string>")] string structure)
+ public void Translation_Tokens([Values("anonymous object", "class", "IDictionary<string, object>", "IDictionary<string, string>")] string structure)
{
// arrange
string start = Guid.NewGuid().ToString("N");
@@ -197,6 +197,10 @@ namespace StardewModdingAPI.Tests
translation = translation.Tokens(new { start, middle, end });
break;
+ case "class":
+ translation = translation.Tokens(new TokenModel { Start = start, Middle = middle, End = end });
+ break;
+
case "IDictionary<string, object>":
translation = translation.Tokens(new Dictionary<string, object> { ["start"] = start, ["middle"] = middle, ["end"] = end });
break;
@@ -323,5 +327,22 @@ namespace StardewModdingAPI.Tests
{
return string.Format(Translation.PlaceholderText, key);
}
+
+
+ /*********
+ ** Test models
+ *********/
+ /// <summary>A model used to test token support.</summary>
+ private class TokenModel
+ {
+ /// <summary>A sample token property.</summary>
+ public string Start { get; set; }
+
+ /// <summary>A sample token property.</summary>
+ public string Middle { get; set; }
+
+ /// <summary>A sample token field.</summary>
+ public string End;
+ }
}
}