-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Error CS0426 : The type name 'TestEnum' does not exist in the typ…
- Loading branch information
1 parent
2f222ec
commit 3479831
Showing
16 changed files
with
1,320 additions
and
856 deletions.
There are no files selected for viewing
116 changes: 59 additions & 57 deletions
116
src/NetEscapades.EnumGenerators/SourceGenerationHelper.cs
Large diffs are not rendered by default.
Oops, something went wrong.
83 changes: 83 additions & 0 deletions
83
tests/NetEscapades.EnumGenerators.IntegrationTests/EnumInFooExtensionsTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
using System; | ||
using Foo; | ||
using Xunit; | ||
|
||
namespace NetEscapades.EnumGenerators.IntegrationTests; | ||
|
||
public class EnumInFooExtensionsTests : ExtensionTests<EnumInFoo> | ||
{ | ||
public static TheoryData<EnumInFoo> ValidEnumValues() => new() | ||
{ | ||
EnumInFoo.First, | ||
EnumInFoo.Second, | ||
(EnumInFoo)3, | ||
}; | ||
|
||
public static TheoryData<string> ValuesToParse() => new() | ||
{ | ||
"First", | ||
"Second", | ||
"2nd", | ||
"2ND", | ||
"first", | ||
"SECOND", | ||
"3", | ||
"267", | ||
"-267", | ||
"2147483647", | ||
"3000000000", | ||
"Fourth", | ||
"Fifth", | ||
}; | ||
|
||
protected override string ToStringFast(EnumInFoo value) => value.ToStringFast(); | ||
protected override bool IsDefined(EnumInFoo value) => EnumInFooExtensions.IsDefined(value); | ||
protected override bool IsDefined(string name, bool allowMatchingMetadataAttribute) => EnumInFooExtensions.IsDefined(name, allowMatchingMetadataAttribute: false); | ||
#if READONLYSPAN | ||
protected override bool IsDefined(in ReadOnlySpan<char> name, bool allowMatchingMetadataAttribute) => EnumInFooExtensions.IsDefined(name, allowMatchingMetadataAttribute: false); | ||
#endif | ||
protected override bool TryParse(string name, out EnumInFoo parsed, bool ignoreCase, bool allowMatchingMetadataAttribute) | ||
=> EnumInFooExtensions.TryParse(name, out parsed, ignoreCase); | ||
#if READONLYSPAN | ||
protected override bool TryParse(in ReadOnlySpan<char> name, out EnumInFoo parsed, bool ignoreCase, bool allowMatchingMetadataAttribute) | ||
=> EnumInFooExtensions.TryParse(name, out parsed, ignoreCase); | ||
#endif | ||
|
||
[Theory] | ||
[MemberData(nameof(ValidEnumValues))] | ||
public void GeneratesToStringFast(EnumInFoo value) => GeneratesToStringFastTest(value); | ||
|
||
[Theory] | ||
[MemberData(nameof(ValidEnumValues))] | ||
public void GeneratesIsDefined(EnumInFoo value) => GeneratesIsDefinedTest(value); | ||
|
||
[Theory] | ||
[MemberData(nameof(ValuesToParse))] | ||
public void GeneratesIsDefinedUsingName(string name) => GeneratesIsDefinedTest(name, allowMatchingMetadataAttribute: false); | ||
|
||
#if READONLYSPAN | ||
[Theory] | ||
[MemberData(nameof(ValuesToParse))] | ||
public void GeneratesIsDefinedUsingNameAsSpan(string name) => GeneratesIsDefinedTest(name.AsSpan(), allowMatchingMetadataAttribute: false); | ||
#endif | ||
|
||
[Theory] | ||
[MemberData(nameof(ValuesToParse))] | ||
public void GeneratesTryParse(string name) => GeneratesTryParseTest(name, ignoreCase: false, allowMatchingMetadataAttribute: false); | ||
|
||
#if READONLYSPAN | ||
[Theory] | ||
[MemberData(nameof(ValuesToParse))] | ||
public void GeneratesTryParseUsingSpan(string name) => GeneratesTryParseTest(name.AsSpan(), ignoreCase: false, allowMatchingMetadataAttribute: false); | ||
#endif | ||
|
||
[Theory] | ||
[MemberData(nameof(ValuesToParse))] | ||
public void GeneratesTryParseIgnoreCase(string name) => GeneratesTryParseTest(name, ignoreCase: true, allowMatchingMetadataAttribute: false); | ||
|
||
[Fact] | ||
public void GeneratesGetValues() => GeneratesGetValuesTest(EnumInFooExtensions.GetValues()); | ||
|
||
[Fact] | ||
public void GeneratesGetNames() => base.GeneratesGetNamesTest(EnumInFooExtensions.GetNames()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
160 changes: 80 additions & 80 deletions
160
...ts/Snapshots/EnumGeneratorTests.CanGenerateEnumExtensionsForFlagsEnum_Params.verified.txt
Large diffs are not rendered by default.
Oops, something went wrong.
130 changes: 65 additions & 65 deletions
130
...Tests/Snapshots/EnumGeneratorTests.CanGenerateEnumExtensionsInChildNamespace.verified.txt
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.