Skip to content

Commit

Permalink
Add defined value test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
xin9le committed Dec 26, 2024
1 parent 998f581 commit 10f1d39
Show file tree
Hide file tree
Showing 10 changed files with 66 additions and 69 deletions.
16 changes: 8 additions & 8 deletions src/insights/FastEnum.UnitTests/Cases/Generators/BasicTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ public sealed class BasicSByteTests
public void GetName()
{
//--- defined value
foreach (var defined in Enum.GetValues<SByteEnum>())
{
const SByteEnum defined = SByteEnum.MinValue;
var expect = Enum.GetName(defined);
var actual = FastEnum.GetName<SByteEnum, SByteEnumBooster>(defined);
actual.Should().NotBeNull();
Expand Down Expand Up @@ -206,8 +206,8 @@ public sealed class BasicByteTests
public void GetName()
{
//--- defined value
foreach (var defined in Enum.GetValues<ByteEnum>())
{
const ByteEnum defined = ByteEnum.MinValue;
var expect = Enum.GetName(defined);
var actual = FastEnum.GetName<ByteEnum, ByteEnumBooster>(defined);
actual.Should().NotBeNull();
Expand Down Expand Up @@ -384,8 +384,8 @@ public sealed class BasicInt16Tests
public void GetName()
{
//--- defined value
foreach (var defined in Enum.GetValues<Int16Enum>())
{
const Int16Enum defined = Int16Enum.MinValue;
var expect = Enum.GetName(defined);
var actual = FastEnum.GetName<Int16Enum, Int16EnumBooster>(defined);
actual.Should().NotBeNull();
Expand Down Expand Up @@ -568,8 +568,8 @@ public sealed class BasicUInt16Tests
public void GetName()
{
//--- defined value
foreach (var defined in Enum.GetValues<UInt16Enum>())
{
const UInt16Enum defined = UInt16Enum.MinValue;
var expect = Enum.GetName(defined);
var actual = FastEnum.GetName<UInt16Enum, UInt16EnumBooster>(defined);
actual.Should().NotBeNull();
Expand Down Expand Up @@ -746,8 +746,8 @@ public sealed class BasicInt32Tests
public void GetName()
{
//--- defined value
foreach (var defined in Enum.GetValues<Int32Enum>())
{
const Int32Enum defined = Int32Enum.MinValue;
var expect = Enum.GetName(defined);
var actual = FastEnum.GetName<Int32Enum, Int32EnumBooster>(defined);
actual.Should().NotBeNull();
Expand Down Expand Up @@ -930,8 +930,8 @@ public sealed class BasicUInt32Tests
public void GetName()
{
//--- defined value
foreach (var defined in Enum.GetValues<UInt32Enum>())
{
const UInt32Enum defined = UInt32Enum.MinValue;
var expect = Enum.GetName(defined);
var actual = FastEnum.GetName<UInt32Enum, UInt32EnumBooster>(defined);
actual.Should().NotBeNull();
Expand Down Expand Up @@ -1108,8 +1108,8 @@ public sealed class BasicInt64Tests
public void GetName()
{
//--- defined value
foreach (var defined in Enum.GetValues<Int64Enum>())
{
const Int64Enum defined = Int64Enum.MinValue;
var expect = Enum.GetName(defined);
var actual = FastEnum.GetName<Int64Enum, Int64EnumBooster>(defined);
actual.Should().NotBeNull();
Expand Down Expand Up @@ -1292,8 +1292,8 @@ public sealed class BasicUInt64Tests
public void GetName()
{
//--- defined value
foreach (var defined in Enum.GetValues<UInt64Enum>())
{
const UInt64Enum defined = UInt64Enum.MinValue;
var expect = Enum.GetName(defined);
var actual = FastEnum.GetName<UInt64Enum, UInt64EnumBooster>(defined);
actual.Should().NotBeNull();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ public sealed class Basic<#= x.AliasType #>Tests
public void GetName()
{
//--- defined value
foreach (var defined in Enum.GetValues<<#= x.EnumType #>>())
{
const <#= x.EnumType #> defined = <#= x.EnumType #>.MinValue;
var expect = Enum.GetName(defined);
var actual = FastEnum.GetName<<#= x.EnumType #>, <#= x.BoosterType #>>(defined);
actual.Should().NotBeNull();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ public sealed class SameValueContinuousTests
[TestMethod]
public void GetName()
{
var values = Enum.GetValues<SameValueContinuousEnum>();
foreach (var x in values)
foreach (var x in Enum.GetValues<SameValueContinuousEnum>())
{
var expect = Enum.GetName(x);
var actual = FastEnum.GetName<SameValueContinuousEnum, SameValueContinuousEnumBooster>(x);
Expand Down Expand Up @@ -199,8 +198,7 @@ public sealed class SameValueDiscontinuousTests
[TestMethod]
public void GetName()
{
var values = Enum.GetValues<SameValueDiscontinuousEnum>();
foreach (var x in values)
foreach (var x in Enum.GetValues<SameValueDiscontinuousEnum>())
{
var expect = Enum.GetName(x);
var actual = FastEnum.GetName<SameValueDiscontinuousEnum, SameValueDiscontinuousEnumBooster>(x);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ public sealed class SameValue<#= x.IsContinuous ? "Continuous" : "Discontinuous"
[TestMethod]
public void GetName()
{
var values = Enum.GetValues<<#= x.EnumType #>>();
foreach (var x in values)
foreach (var x in Enum.GetValues<<#= x.EnumType #>>())
{
var expect = Enum.GetName(x);
var actual = FastEnum.GetName<<#= x.EnumType #>, <#= x.BoosterType #>>(x);
Expand Down
32 changes: 16 additions & 16 deletions src/insights/FastEnum.UnitTests/Cases/Reflections/BasicTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ public void GetNames()
public void GetName()
{
//--- defined value
foreach (var defined in Enum.GetValues<SByteEnum>())
{
const SByteEnum defined = SByteEnum.MinValue;
var expect = Enum.GetName(defined);
var actual = FastEnum.GetName(defined);
actual.Should().NotBeNull();
Expand Down Expand Up @@ -100,8 +100,8 @@ var expect
public void GetMember()
{
//--- defined value
foreach (var defined in Enum.GetValues<SByteEnum>())
{
const SByteEnum defined = SByteEnum.MinValue;
var expect = getMember(defined);
var actual = FastEnum.GetMember(defined)!;

Expand Down Expand Up @@ -405,8 +405,8 @@ public void GetNames()
public void GetName()
{
//--- defined value
foreach (var defined in Enum.GetValues<ByteEnum>())
{
const ByteEnum defined = ByteEnum.MinValue;
var expect = Enum.GetName(defined);
var actual = FastEnum.GetName(defined);
actual.Should().NotBeNull();
Expand Down Expand Up @@ -459,8 +459,8 @@ var expect
public void GetMember()
{
//--- defined value
foreach (var defined in Enum.GetValues<ByteEnum>())
{
const ByteEnum defined = ByteEnum.MinValue;
var expect = getMember(defined);
var actual = FastEnum.GetMember(defined)!;

Expand Down Expand Up @@ -756,8 +756,8 @@ public void GetNames()
public void GetName()
{
//--- defined value
foreach (var defined in Enum.GetValues<Int16Enum>())
{
const Int16Enum defined = Int16Enum.MinValue;
var expect = Enum.GetName(defined);
var actual = FastEnum.GetName(defined);
actual.Should().NotBeNull();
Expand Down Expand Up @@ -810,8 +810,8 @@ var expect
public void GetMember()
{
//--- defined value
foreach (var defined in Enum.GetValues<Int16Enum>())
{
const Int16Enum defined = Int16Enum.MinValue;
var expect = getMember(defined);
var actual = FastEnum.GetMember(defined)!;

Expand Down Expand Up @@ -1115,8 +1115,8 @@ public void GetNames()
public void GetName()
{
//--- defined value
foreach (var defined in Enum.GetValues<UInt16Enum>())
{
const UInt16Enum defined = UInt16Enum.MinValue;
var expect = Enum.GetName(defined);
var actual = FastEnum.GetName(defined);
actual.Should().NotBeNull();
Expand Down Expand Up @@ -1169,8 +1169,8 @@ var expect
public void GetMember()
{
//--- defined value
foreach (var defined in Enum.GetValues<UInt16Enum>())
{
const UInt16Enum defined = UInt16Enum.MinValue;
var expect = getMember(defined);
var actual = FastEnum.GetMember(defined)!;

Expand Down Expand Up @@ -1466,8 +1466,8 @@ public void GetNames()
public void GetName()
{
//--- defined value
foreach (var defined in Enum.GetValues<Int32Enum>())
{
const Int32Enum defined = Int32Enum.MinValue;
var expect = Enum.GetName(defined);
var actual = FastEnum.GetName(defined);
actual.Should().NotBeNull();
Expand Down Expand Up @@ -1520,8 +1520,8 @@ var expect
public void GetMember()
{
//--- defined value
foreach (var defined in Enum.GetValues<Int32Enum>())
{
const Int32Enum defined = Int32Enum.MinValue;
var expect = getMember(defined);
var actual = FastEnum.GetMember(defined)!;

Expand Down Expand Up @@ -1825,8 +1825,8 @@ public void GetNames()
public void GetName()
{
//--- defined value
foreach (var defined in Enum.GetValues<UInt32Enum>())
{
const UInt32Enum defined = UInt32Enum.MinValue;
var expect = Enum.GetName(defined);
var actual = FastEnum.GetName(defined);
actual.Should().NotBeNull();
Expand Down Expand Up @@ -1879,8 +1879,8 @@ var expect
public void GetMember()
{
//--- defined value
foreach (var defined in Enum.GetValues<UInt32Enum>())
{
const UInt32Enum defined = UInt32Enum.MinValue;
var expect = getMember(defined);
var actual = FastEnum.GetMember(defined)!;

Expand Down Expand Up @@ -2176,8 +2176,8 @@ public void GetNames()
public void GetName()
{
//--- defined value
foreach (var defined in Enum.GetValues<Int64Enum>())
{
const Int64Enum defined = Int64Enum.MinValue;
var expect = Enum.GetName(defined);
var actual = FastEnum.GetName(defined);
actual.Should().NotBeNull();
Expand Down Expand Up @@ -2230,8 +2230,8 @@ var expect
public void GetMember()
{
//--- defined value
foreach (var defined in Enum.GetValues<Int64Enum>())
{
const Int64Enum defined = Int64Enum.MinValue;
var expect = getMember(defined);
var actual = FastEnum.GetMember(defined)!;

Expand Down Expand Up @@ -2535,8 +2535,8 @@ public void GetNames()
public void GetName()
{
//--- defined value
foreach (var defined in Enum.GetValues<UInt64Enum>())
{
const UInt64Enum defined = UInt64Enum.MinValue;
var expect = Enum.GetName(defined);
var actual = FastEnum.GetName(defined);
actual.Should().NotBeNull();
Expand Down Expand Up @@ -2589,8 +2589,8 @@ var expect
public void GetMember()
{
//--- defined value
foreach (var defined in Enum.GetValues<UInt64Enum>())
{
const UInt64Enum defined = UInt64Enum.MinValue;
var expect = getMember(defined);
var actual = FastEnum.GetMember(defined)!;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ public sealed class Basic<#= x.AliasType #>Tests
public void GetName()
{
//--- defined value
foreach (var defined in Enum.GetValues<<#= x.EnumType #>>())
{
const <#= x.EnumType #> defined = <#= x.EnumType #>.MinValue;
var expect = Enum.GetName(defined);
var actual = FastEnum.GetName(defined);
actual.Should().NotBeNull();
Expand Down Expand Up @@ -119,8 +119,8 @@ public sealed class Basic<#= x.AliasType #>Tests
public void GetMember()
{
//--- defined value
foreach (var defined in Enum.GetValues<<#= x.EnumType #>>())
{
const <#= x.EnumType #> defined = <#= x.EnumType #>.MinValue;
var expect = getMember(defined);
var actual = FastEnum.GetMember(defined)!;

Expand Down
Loading

0 comments on commit 10f1d39

Please sign in to comment.