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.
32 lines
1.0 KiB
C#
32 lines
1.0 KiB
C#
using NUnit.Framework;
|
|
using Robust.Shared.Utility;
|
|
|
|
// ReSharper disable once CheckNamespace
|
|
namespace Robust.Shared.TestPrettyPrint;
|
|
|
|
public sealed class Foo
|
|
{
|
|
override public string ToString() { return "ACustomFooRep"; }
|
|
}
|
|
|
|
public sealed class Bar {}
|
|
|
|
[TestFixture]
|
|
[Parallelizable(ParallelScope.Fixtures | ParallelScope.All)]
|
|
[TestOf(typeof(PrettyPrint))]
|
|
internal sealed class PrettyPrint_Test
|
|
{
|
|
private static IEnumerable<(object val, string expectedRep, string expectedTypeRep)> TestCases { get; } = new (object, string, string)[]
|
|
{
|
|
(new Foo(), "ACustomFooRep", "R.Sh.TestPrettyPrint.Foo"),
|
|
(new Robust.Shared.TestPrettyPrint.Bar(), "R.Sh.TestPrettyPrint.Bar", ""),
|
|
};
|
|
|
|
[Test]
|
|
public void Test([ValueSource(nameof(TestCases))] (object value, string expectedRep, string expectedTypeRep) data)
|
|
{
|
|
Assert.That(PrettyPrint.PrintUserFacingWithType(data.value, out var typeRep), Is.EqualTo(data.expectedRep));
|
|
Assert.That(typeRep, Is.EqualTo(data.expectedTypeRep));
|
|
}
|
|
}
|