Files
speckle-sharp-sdk/tests/Speckle.Sdk.Tests.Unit/Serialisation/PrimitiveTestFixture.cs
T
Adam Hathcock 14d959834f Convert to Xunit (#196)
* xunit unit tests

* most pass with formatting

* convert objects to xunit

* remove nunit

* format

* merge fixes

* switch objects to fluent assertions

* update to fluent assertions

* more FA

* convert all to FA

* Format

* Fix tests

* formatting

* hopefully made credential test better

* Catch more specific exception

* use another more specific exception

* Fix tests

* update to xunit

* update packages
2025-01-09 15:32:28 +00:00

49 lines
1.6 KiB
C#

namespace Speckle.Sdk.Tests.Unit.Serialisation;
public abstract class PrimitiveTestFixture
{
public static IEnumerable<object[]> Int8TestCases =>
new sbyte[] { 0, sbyte.MaxValue, sbyte.MinValue }.Select(x => new object[] { x });
public static readonly short[] Int16TestCases = [short.MaxValue, short.MinValue];
public static IEnumerable<object[]> Int32TestCases =>
new int[] { int.MinValue, int.MaxValue }.Select(x => new object[] { x });
public static IEnumerable<object[]> Int64TestCases =>
new long[] { long.MinValue, long.MaxValue }.Select(x => new object[] { x });
public static IEnumerable<object[]> UInt64TestCases =>
new ulong[] { ulong.MinValue, ulong.MaxValue }.Select(x => new object[] { x });
public static IEnumerable<object[]> Float64TestCases =>
new[]
{
0,
double.Epsilon,
double.MaxValue,
double.MinValue,
double.PositiveInfinity,
double.NegativeInfinity,
double.NaN,
}.Select(x => new object[] { x });
public static IEnumerable<object[]> Float32TestCases =>
new[]
{
default,
float.Epsilon,
float.MaxValue,
float.MinValue,
float.PositiveInfinity,
float.NegativeInfinity,
float.NaN,
}.Select(x => new object[] { x });
public static Half[] Float16TestCases { get; } =
[default, Half.Epsilon, Half.MaxValue, Half.MinValue, Half.PositiveInfinity, Half.NegativeInfinity, Half.NaN];
public static float[] FloatIntegralTestCases { get; } = [0, 1, int.MaxValue, int.MinValue];
public static IEnumerable<object[]> MyEnums { get; } =
Enum.GetValues(typeof(MyEnum)).Cast<object>().Select(x => new[] { x });
}