forked from bUnit-dev/bUnit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Respect base properties (bUnit-dev#1572)
* feat: Respect base properties * Update src/bunit.generators/Web.Stubs/MemberRetriever.cs Co-authored-by: Egil Hansen <[email protected]> --------- Co-authored-by: Egil Hansen <[email protected]>
- Loading branch information
1 parent
b9f8911
commit 0f76e56
Showing
5 changed files
with
72 additions
and
5 deletions.
There are no files selected for viewing
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
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,19 @@ | ||
using Microsoft.CodeAnalysis; | ||
|
||
namespace Bunit.Web.Stubs; | ||
|
||
internal static class MemberRetriever | ||
{ | ||
public static IEnumerable<ISymbol> GetAllMembersRecursively(this ITypeSymbol type) | ||
{ | ||
var currentType = type; | ||
while (currentType is not null) | ||
{ | ||
foreach (var member in currentType.GetMembers()) | ||
{ | ||
yield return member; | ||
} | ||
currentType = currentType.BaseType; | ||
} | ||
} | ||
} |
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
14 changes: 14 additions & 0 deletions
14
tests/bunit.generators.tests/Web.Stub/Components/ContainerComponent.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,14 @@ | ||
namespace Bunit.Web.Stub.Components; | ||
|
||
public class ContainerComponent : ComponentBase | ||
{ | ||
[Parameter] | ||
public RenderFragment ChildContent { get; set; } | ||
|
||
protected override void BuildRenderTree(RenderTreeBuilder builder) | ||
{ | ||
builder.OpenElement(0, "div"); | ||
builder.AddContent(1, ChildContent); | ||
builder.CloseElement(); | ||
} | ||
} |