2020-07-15 13:32:59 +00:00
|
|
|
|
namespace X10D.Tests.Core
|
2020-04-19 15:16:28 +00:00
|
|
|
|
{
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2020-07-15 13:32:59 +00:00
|
|
|
|
/// Tests for <see cref="StringExtensions" />.
|
2020-04-19 15:16:28 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
[TestClass]
|
|
|
|
|
public class StringTests
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
2020-07-15 13:32:59 +00:00
|
|
|
|
/// Tests for <see cref="StringExtensions.Repeat" />.
|
2020-04-19 15:16:28 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
[TestMethod]
|
|
|
|
|
public void Repeat()
|
|
|
|
|
{
|
|
|
|
|
Assert.AreEqual("foofoofoofoofoo", "foo".Repeat(5));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2020-07-15 13:32:59 +00:00
|
|
|
|
/// Tests for <see cref="StringExtensions.Split" />.
|
2020-04-19 15:16:28 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
[TestMethod]
|
|
|
|
|
public void Split()
|
|
|
|
|
{
|
|
|
|
|
const string str = "Hello World";
|
|
|
|
|
|
|
|
|
|
// ReSharper disable once SuggestVarOrType_Elsewhere
|
|
|
|
|
var arr = str.Split(2).ToArray();
|
|
|
|
|
CollectionAssert.AreEqual(new[] { "He", "ll", "o ", "Wo", "rl", "d" }, arr);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|