Skip to content

Commit

Permalink
docs: Fix links and formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
linkdotnet committed Feb 6, 2024
1 parent 2722aca commit 9126213
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion docs/site/docs/test-doubles/mocking-localizer.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@ title: Mocking Localization via IStringLocalizer
---

<p>There are just two steps. First in your setup add the following:</p>

```csharp
TestContext.Services.AddLocalization();
```

<p>Then in your test code, when you need the localized string to compare, you write the following:</p>

```csharp
var localizer = ctx.Services.GetService<IStringLocalizer<SharedStrings>>();
```
```

<p>Where SharedStrings.cs (you can name this anything you want) that has the resource files such as `SharedStrings.en.resx`</p>
1 change: 1 addition & 0 deletions docs/site/docs/toc.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
## [Emulating IJSRuntime](xref:emulating-ijsruntime)
## [Faking authorization](xref:faking-auth)
## [Mocking HttpClient](xref:mocking-httpclient)
## [Mocking Localizer](xref:mocking-localizer)
## [Faking PersistentComponentState](xref:faking-persistentcomponentstate)
## [Faking NavigationManager](xref:fake-navigation-manager)
## [Faking IWebAssemblyHostEnvironment](xref:fake-webassemblyhostenvironment)
Expand Down

0 comments on commit 9126213

Please sign in to comment.