Skip to content

Commit 01e9e71

Browse files
linkdotnetbUnitBot
authored andcommitted
feat: Added Debugger hints
1 parent 0a31cdc commit 01e9e71

5 files changed

Lines changed: 13 additions & 1 deletion

File tree

src/bunit.web/Extensions/Internal/RefreshableElementCollection.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
using System.Collections;
2+
using System.Diagnostics;
23
using AngleSharp.Dom;
34

45
namespace Bunit;
56

7+
[DebuggerDisplay("Selector={cssSelector}, AutoRefresh={enableAutoRefresh}")]
68
internal sealed class RefreshableElementCollection : IRefreshableElementCollection<IElement>
79
{
810
private readonly IRenderedFragment renderedFragment;

src/bunit.web/Rendering/RenderedComponent.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
using System.Diagnostics;
2+
13
namespace Bunit.Rendering;
24

35
/// <inheritdoc/>
6+
[DebuggerDisplay("Component={typeof(TComponent).Name,nq},RenderCount={RenderCount}")]
47
internal sealed class RenderedComponent<TComponent> : RenderedFragment, IRenderedComponent<TComponent>
58
where TComponent : IComponent
69
{

src/bunit.web/Rendering/RenderedFragment.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
using System.Diagnostics;
12
using AngleSharp.Diffing.Core;
23
using AngleSharp.Dom;
34

45
namespace Bunit.Rendering;
56

67
/// <inheritdoc />
8+
[DebuggerDisplay("Rendered:{RenderCount}")]
79
internal class RenderedFragment : IRenderedFragment
810
{
911
[SuppressMessage("Usage", "CA2213:Disposable fields should be disposed", Justification = "Owned by TestServiceProvider, disposed by it.")]

src/bunit.web/TestDoubles/NavigationManager/FakeNavigationManager.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System.Diagnostics;
12
using Bunit.Rendering;
23
using Microsoft.AspNetCore.Components.Routing;
34

@@ -9,6 +10,7 @@ namespace Bunit.TestDoubles;
910
/// Represents a fake <see cref="NavigationManager"/> that captures calls to
1011
/// <see cref="NavigationManager.NavigateTo(string, bool)"/> for testing purposes.
1112
/// </summary>
13+
[DebuggerDisplay("Current Uri: {Uri}, History Count: {History.Count}")]
1214
public sealed class FakeNavigationManager : NavigationManager
1315
{
1416
private readonly TestContextBase testContextBase;

src/bunit.web/TestDoubles/NavigationManager/NavigationHistory.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1+
using System.Diagnostics;
12
using System.Text.Json;
23
using Microsoft.AspNetCore.Components.Routing;
3-
using Microsoft.AspNetCore.Components.WebAssembly.Authentication;
44

55
namespace Bunit.TestDoubles;
66

77
/// <summary>
88
/// Represents a navigation to a <seealso cref="Uri"/> with a set of specific navigation <seealso cref="Options"/>.
99
/// </summary>
10+
[DebuggerDisplay("Uri={Uri}, NavigationState={State}, HasException={HasException}")]
1011
public sealed record NavigationHistory
1112
{
1213
/// <summary>
@@ -33,6 +34,8 @@ public sealed record NavigationHistory
3334
/// </remarks>
3435
public Exception? Exception { get; }
3536

37+
private bool HasException => Exception is not null;
38+
3639
/// <summary>
3740
/// Initializes a new instance of the <see cref="NavigationHistory"/> class.
3841
/// </summary>

0 commit comments

Comments
 (0)