mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-15 03:30:53 +01:00
Robust.UnitTesting was both ALL tests for RT, and also API surface for content tests. Tests are now split into separate projects as appropriate, and the API side has also been split off.
35 lines
1.1 KiB
C#
35 lines
1.1 KiB
C#
using NUnit.Framework;
|
|
using Robust.Shared.Utility;
|
|
|
|
namespace Robust.Shared.Tests.Utility
|
|
{
|
|
[Parallelizable(ParallelScope.All | ParallelScope.Fixtures)]
|
|
[TestFixture]
|
|
internal sealed class CollectionExtensions_Test
|
|
{
|
|
[Test]
|
|
public void RemoveSwapTest()
|
|
{
|
|
var list = new List<int> {1, 2, 3};
|
|
list.RemoveSwap(2);
|
|
Assert.That(list, Is.EqualTo(new List<int> {1, 2}));
|
|
|
|
list = new List<int> {1, 2, 3};
|
|
list.RemoveSwap(0);
|
|
Assert.That(list, Is.EqualTo(new List<int> {3, 2}));
|
|
}
|
|
|
|
[Test]
|
|
public void TestFirstOrNull()
|
|
{
|
|
Assert.That(Enumerable.Empty<int>().FirstOrNull(), Is.Null);
|
|
Assert.That(new[] {1}.FirstOrNull(), Is.EqualTo(1));
|
|
Assert.That(new[] {1, 2, 3}.FirstOrNull(), Is.EqualTo(1));
|
|
|
|
Assert.That(Enumerable.Empty<int>().FirstOrNull(p => p == 2), Is.Null);
|
|
Assert.That(new[] {1}.FirstOrNull(p => p == 2), Is.Null);
|
|
Assert.That(new[] {1, 2, 3}.FirstOrNull(p => p == 2), Is.EqualTo(2));
|
|
}
|
|
}
|
|
}
|