mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-17 05:35:07 +00:00
test: Adding test case for RemoveCharacters string extension method
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using ICD.Common.Utils.Extensions;
|
||||
using NUnit.Framework;
|
||||
|
||||
@@ -11,7 +12,7 @@ namespace ICD.Common.Utils.Tests.Extensions
|
||||
public void IndexOfTest()
|
||||
{
|
||||
string first;
|
||||
Assert.AreEqual(5, "test1test3test2".IndexOf(new[] { "test2", "test3" }, out first));
|
||||
Assert.AreEqual(5, "test1test3test2".IndexOf(new[] {"test2", "test3"}, out first));
|
||||
Assert.AreEqual("test3", first);
|
||||
}
|
||||
|
||||
@@ -57,10 +58,11 @@ namespace ICD.Common.Utils.Tests.Extensions
|
||||
Assert.AreEqual(expected, value.RemoveWhitespace());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void RemoveCharactersTest()
|
||||
[TestCase("1234567890", new[] {'2', '6'}, "13457890")]
|
||||
[TestCase("912529434324", new[] {'-', '(', ')', '.', '+'}, "912529434324")]
|
||||
public void RemoveCharactersTest(string value, IEnumerable<char> characters, string expected)
|
||||
{
|
||||
Assert.AreEqual("13457890", "1234567890".Remove(new[] { '2', '6' }));
|
||||
Assert.AreEqual(expected, value.Remove(characters));
|
||||
}
|
||||
|
||||
[TestCase(true, "27652")]
|
||||
|
||||
Reference in New Issue
Block a user