We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 83ef62f commit 1bb7f47Copy full SHA for 1bb7f47
docs/site/docs/test-doubles/mocking-localizer.md
@@ -3,4 +3,12 @@ uid: mocking-localizer
3
title: Mocking Localization via IStringLocalizer
4
---
5
6
-# Mocking Localization via `IStringLocalizer`
+<p>There are just two steps. First in your setup add the following:</p>
7
+```csharp
8
+TestContext.Services.AddLocalization();
9
+```
10
+<p>Then in your test code, when you need the localized string to compare, you write the following:</p>
11
12
+var localizer = ctx.Services.GetService<IStringLocalizer<SharedStrings>>();
13
+ ```
14
+<p>Where SharedStrings.cs (you can name this anything you want) that has the resource files such as `SharedStrings.en.resx`</p>
0 commit comments