1
0
mirror of https://github.com/oliverbooth/X10D synced 2024-11-23 00:18:47 +00:00

Remove char.Random test

This commit is contained in:
Oliver Booth 2022-02-14 16:04:57 +00:00
parent e0e7965557
commit 6c27227c3e

View File

@ -1,4 +1,4 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace X10D.Tests.Core
{
@ -8,26 +8,17 @@ namespace X10D.Tests.Core
[TestClass]
public class CharTests
{
/// <summary>
/// Tests for <see cref="CharExtensions.Repeat" />.
/// </summary>
[TestMethod]
public void Random()
{
var set = "abcdefghijklmnopqrstuvwxyz".ToCharArray();
var random = set.Random(20);
Assert.IsTrue(random.All(c => Array.IndexOf(set, c) >= 0));
Assert.IsFalse(random.Any(c => Array.IndexOf(set, c) < -1));
}
/// <summary>
/// Tests for <see cref="CharExtensions.Repeat" />.
/// </summary>
[TestMethod]
public void Repeat()
{
Assert.AreEqual("aaaaaaaaaa", 'a'.Repeat(10));
const char character = 'a';
const int repeatCount = 10;
const string repeated = "aaaaaaaaaa";
var result = character.Repeat(repeatCount);
Assert.AreEqual(repeated, result);
Assert.ThrowsException<ArgumentOutOfRangeException>(() => character.Repeat(-1));
}
}
}