aboutsummaryrefslogtreecommitdiff
path: root/tests/Jellyfin.Model.Tests/Extensions/StringHelperTests.cs
diff options
context:
space:
mode:
authorClaus Vium <cvium@users.noreply.github.com>2021-06-07 09:46:46 +0200
committerGitHub <noreply@github.com>2021-06-07 09:46:46 +0200
commit1c6bf16d155b13ecd3ed78c14b1a682b3a9d5d3c (patch)
tree166283bd9dc5ee008f55b8fe5c2e184d89a916c9 /tests/Jellyfin.Model.Tests/Extensions/StringHelperTests.cs
parentb8f5a14384e1c746e80d39517a87a4e65c5c1126 (diff)
parentce434ebc7a564ce0fc07f9a2b5f16c0ca3da404f (diff)
Merge pull request #6150 from Bond-009/proptest
Diffstat (limited to 'tests/Jellyfin.Model.Tests/Extensions/StringHelperTests.cs')
-rw-r--r--tests/Jellyfin.Model.Tests/Extensions/StringHelperTests.cs14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/Jellyfin.Model.Tests/Extensions/StringHelperTests.cs b/tests/Jellyfin.Model.Tests/Extensions/StringHelperTests.cs
index 5864a0509..0a4e060df 100644
--- a/tests/Jellyfin.Model.Tests/Extensions/StringHelperTests.cs
+++ b/tests/Jellyfin.Model.Tests/Extensions/StringHelperTests.cs
@@ -1,3 +1,6 @@
+using System;
+using FsCheck;
+using FsCheck.Xunit;
using MediaBrowser.Model.Extensions;
using Xunit;
@@ -10,9 +13,20 @@ namespace Jellyfin.Model.Tests.Extensions
[InlineData("banana", "Banana")]
[InlineData("Banana", "Banana")]
[InlineData("ä", "Ä")]
+ [InlineData("\027", "\027")]
public void StringHelper_ValidArgs_Success(string input, string expectedResult)
{
Assert.Equal(expectedResult, StringHelper.FirstToUpper(input));
}
+
+ [Property]
+ public Property FirstToUpper_RandomArg_Correct(NonEmptyString input)
+ {
+ var result = StringHelper.FirstToUpper(input.Item);
+
+ // We check IsLower instead of IsUpper because both return false for non-letters
+ return (!char.IsLower(result[0])).Label("First char is uppercase")
+ .And(input.Item.Length == 1 || result[1..].Equals(input.Item[1..], StringComparison.Ordinal)).Label("Remaining chars are unmodified");
+ }
}
}