Skip to content

Commit

Permalink
Improve tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
byme8 committed Jun 12, 2024
1 parent b09fa76 commit a416434
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
Name: User
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
Name: User
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
Name: User
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
Name: Admin,
RawValue: 1,
Value: Admin,
Attributes: [
{
Description: Admin user,
TypeId: DescriptionAttribute
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
null
25 changes: 21 additions & 4 deletions src/Apparatus.AOT.Reflection.Tests/AOTReflectionEnumsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,30 @@ public async Task GetEnumValueInfoWorks()
await Verify(result);
}

[Fact]
public async Task CreateEnumFromIntWorks()
[Theory]
[InlineData(0)]
[InlineData(1)]
[InlineData(2)]
public async Task GetAndDefaultEnumFromIntWorks(int value)
{
var project = TestProject.Project;
var result = await project.ExecuteTest("return EnumHelper.CreateOrDefault(1, UserKind.User);");
var result = await project.ExecuteTest($"return EnumHelper.GetOrDefault({value}, UserKind.User);");

await Verify(result);
await Verify(result)
.UseParameters(value);
}

[Theory]
[InlineData(0)]
[InlineData(1)]
[InlineData(2)]
public async Task GetEnumFromIntWorks(int value)
{
var project = TestProject.Project;
var result = await project.ExecuteTest($"return EnumHelper.Get<UserKind>({value});");

await Verify(result)
.UseParameters(value);
}

[Fact]
Expand Down

0 comments on commit a416434

Please sign in to comment.