-
-
Notifications
You must be signed in to change notification settings - Fork 119
Expand file tree
/
Copy pathIRenderedComponent.cs
More file actions
78 lines (62 loc) · 2 KB
/
IRenderedComponent.cs
File metadata and controls
78 lines (62 loc) · 2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
using AngleSharp.Dom;
using Bunit.Rendering;
namespace Bunit;
internal interface IRenderedComponent : IDisposable
{
/// <summary>
/// Gets the id of the rendered component or fragment.
/// </summary>
int ComponentId { get; }
/// <summary>
/// Gets the total number times the fragment has been through its render life-cycle.
/// </summary>
int RenderCount { get; set; }
void UpdateMarkup();
void SetMarkupIndices(int start, int end);
bool IsDirty { get; set; }
IRenderedComponent? Root { get; }
}
/// <summary>
/// Represents a rendered component.
/// </summary>
public interface IRenderedComponent<out TComponent> : IDisposable
where TComponent : IComponent
{
/// <summary>
/// Gets the component under test.
/// </summary>
TComponent Instance { get; }
/// <summary>
/// Gets the HTML markup from the rendered fragment/component.
/// </summary>
string Markup { get; }
/// <summary>
/// Gets a value indicating whether the rendered component or fragment has been disposed by the <see cref="BunitRenderer"/>.
/// </summary>
bool IsDisposed { get; }
/// <summary>
/// Gets the id of the rendered component or fragment.
/// </summary>
int ComponentId { get; }
/// <summary>
/// Gets the total number times the fragment has been through its render life-cycle.
/// </summary>
int RenderCount { get; }
/// <summary>
/// Gets the AngleSharp <see cref="INodeList"/> based
/// on the HTML markup from the rendered fragment/component.
/// </summary>
INodeList Nodes { get; }
/// <summary>
/// Gets the <see cref="IServiceProvider"/> used when rendering the component.
/// </summary>
IServiceProvider Services { get; }
/// <summary>
/// Adds or removes an event handler that will be triggered after each render of this <see cref="IRenderedComponent{TComponent}"/>.
/// </summary>
event EventHandler? OnAfterRender;
/// <summary>
/// An event that is raised after the markup of the <see cref="IRenderedComponent{TComponent}"/> is updated.
/// </summary>
event EventHandler? OnMarkupUpdated;
}