Skip to content

Commit e57eec1

Browse files
linkdotnetegil
authored andcommitted
add documentation
1 parent 6d7285a commit e57eec1

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

src/bunit.web/Extensions/StubComponentFactoryCollectionExtensions.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,18 @@ public static ComponentFactoryCollection AddStub(
164164

165165
#if NET8_0_OR_GREATER
166166
/// <summary>
167-
/// TODO.
167+
/// Marks a component as a stub component so that a stub gets generated for it. The stub has the same name as the component, but with the suffix "Stub" added.
168168
/// </summary>
169-
#pragma warning disable S2326
170-
public static ComponentFactoryCollection AddGeneratedStub<TComponent>(this ComponentFactoryCollection factories) where TComponent : IComponent
169+
/// <typeparam name="TComponent">The type of component to generate a stub for.</typeparam>
170+
/// <remarks>
171+
/// When <c>ComponentFactories.AddGeneratedStub&lt;MyButton&gt;()</c> is called, a stub component is generated for the component
172+
/// with the name <c>MyButtonStub</c>. The stub component is added to the <see cref="ComponentFactoryCollection"/> and can be used.
173+
/// It can also be retrieved via `cut.FindComponent&lt;MyButtonStub&gt;()`.
174+
/// This call does the same as <c>ComponentFactories.Add&lt;MyButton, MyButtonStub&gt;()</c>.
175+
/// </remarks>
176+
#pragma warning disable S2326 // Unused type parameters should be removed - this is just the shape for the interceptor
177+
public static ComponentFactoryCollection AddGeneratedStub<TComponent>(this ComponentFactoryCollection factories)
178+
where TComponent : IComponent
171179
#pragma warning restore S2326
172180
{
173181
if (factories is null)

0 commit comments

Comments
 (0)