Skip to content

Commit

Permalink
XS✔ ◾ Add comment to IApiMarker example (#8114)
Browse files Browse the repository at this point in the history
* Add comments to IApiMarker example.

* Auto-fix Markdown files

* Make more terse

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
ncn-ssw and github-actions[bot] committed Mar 11, 2024
1 parent f9a32e4 commit fabd926
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
Binary file not shown.
16 changes: 13 additions & 3 deletions rules/use-iapimarker-with-webapplicationfactory/rule.md
Expand Up @@ -14,7 +14,7 @@ redirects:
The `WebApplicationFactory` class is used for bootstrapping an application in memory for functional end to end tests. As part of the initialization of the factory you need to reference a type from the application project.

Typically in the past you'd want to use your `Startup` or `Program` classes, the introduction of top-level statements changes how you'd reference those types, so we pivot for consistency.

<!--endintro-->

Top level statements allows for a cleaner `Program` class, but it also means you can't reference it directly without some additional changes.
Expand Down Expand Up @@ -47,8 +47,18 @@ This approach means you don't need to do all the InternalsVisibleTo setup, but d

The `IApiMarker` interface is a simple interface that is used to reference the application project.

```cs
namespace RulesApi;

// This marker interface is required for functional testing using WebApplicationFactory.
// See https://www.ssw.com.au/rules/use-iapimarker-with-webapplicationfactory/
public interface IApiMarker
{
}
```

::: good
![Figure: Good example - Using an IApiMarker interface](Using-IApiMarker-interface.jpg)
Figure: Good example - Using an `IApiMarker` interface
:::

Using the `IApiMarker` interface allows you reference your application project in a consistent way, the approach is the same when you use top level statements or standard Program.Main entry points.
Using the `IApiMarker` interface allows you reference your application project in a consistent way, the approach is the same when you use top level statements or standard Program.Main entry points.

0 comments on commit fabd926

Please sign in to comment.