");
+}
+```
+
+> [!NOTE]
+> If a component under test uses the `ComponentBase.RendererInfo` property and the `SetRendererInfo` on `TestContext` hasn't been passed in a `RendererInfo` object, the renderer will throw an exception.
\ No newline at end of file
diff --git a/docs/site/docs/providing-input/passing-parameters-to-components.md b/docs/site/docs/providing-input/passing-parameters-to-components.md
index 4db2fccf1..a69b91875 100644
--- a/docs/site/docs/providing-input/passing-parameters-to-components.md
+++ b/docs/site/docs/providing-input/passing-parameters-to-components.md
@@ -466,7 +466,8 @@ When rendering a `RenderFragment` using the 's `Add` method, if a component parameter is only annotated with the `[SupplyParameterFromQuery]` attribute. Instead, pass a query string parameters by setting it using the .
diff --git a/docs/site/docs/test-doubles/faking-persistentcomponentstate.md b/docs/site/docs/test-doubles/faking-persistentcomponentstate.md
index c03f78110..9e28aa42c 100644
--- a/docs/site/docs/test-doubles/faking-persistentcomponentstate.md
+++ b/docs/site/docs/test-doubles/faking-persistentcomponentstate.md
@@ -12,7 +12,7 @@ bUnit comes with fake version of the `PersistentComponentState` type in Blazor t
To use the fake `PersistentComponentState` in bUnit, call the `AddFakePersistentComponentState` extension method on `TestContext`:
```csharp
-var fakeState = AddFakePersistentComponentState();
+var fakeState = this.AddFakePersistentComponentState();
```
Calling `AddFakePersistentComponentState` returns a `FakePersistentComponentState` type, which has three methods; one to persist data, one to get persisted data, and one that triggers any "OnPersisting" callbacks added to the `PersistentComponentState`.
@@ -20,7 +20,7 @@ Calling `AddFakePersistentComponentState` returns a `FakePersistentComponentStat
To add data to the `PersistentComponentState` before running a test, i.e. to verify that a component uses the persisted state, use the `Persist` method:
```csharp
-var fakeState = AddFakePersistentComponentState();
+var fakeState = this.AddFakePersistentComponentState();
var key = "STATE KEY";
var data = ...; // data to persist
@@ -31,7 +31,7 @@ fakeState.Persist(key, data);
To trigger a callback registered with the `PersistentComponentState.RegisterOnPersisting` method, use the `TriggerOnPersisting` method on `FakePersistentComponentState`:
```csharp
-var fakeState = AddFakePersistentComponentState();
+var fakeState = this.AddFakePersistentComponentState();
// render component
@@ -41,7 +41,7 @@ fakeState.TriggerOnPersisting();
To check if data has been persisted, use the `TryTake` method:
```csharp
-var fakeState = AddFakePersistentComponentState();
+var fakeState = this.AddFakePersistentComponentState();
var key = "STATE KEY";
// render component, call TriggerOnPersisting
@@ -95,7 +95,7 @@ To test that the `` component uses persisted weather data instead of
```csharp
// Arrange
-var fakeState = AddFakePersistentComponentState();
+var fakeState = this.AddFakePersistentComponentState();
// Persist a single weather forecast with a temperature of 42
fakeState.Persist("weather-data", new [] { new WeatherForecast { Temperature = 42 } });
@@ -111,7 +111,7 @@ To test that the `` component correctly persists weather data when it
```csharp
// Arrange
-var fakeState = AddFakePersistentComponentState();
+var fakeState = this.AddFakePersistentComponentState();
var cut = RenderComponent();
// Act - trigger the FetchData components PersistForecasts method
diff --git a/docs/site/docs/test-doubles/input-file.md b/docs/site/docs/test-doubles/input-file.md
index bae083b5d..c34442d0f 100644
--- a/docs/site/docs/test-doubles/input-file.md
+++ b/docs/site/docs/test-doubles/input-file.md
@@ -25,4 +25,45 @@ inputFile.UploadFile(fileToUpload);
// Assertions...
```
-To upload binary content, create an `InputFileContent` with the `InputFileContent.CreateFromBinary()` method.
\ No newline at end of file
+To upload binary content, create an `InputFileContent` with the `InputFileContent.CreateFromBinary()` method.
+
+## Known limitations
+bUnit's support for the `InputFile` component is limited when uploading and resizing images (using the provided stream).
+
+```razor
+
+
+
+@code {
+ private string imageBase64 = string.Empty;
+
+ private async Task Upload(InputFileChangeEventArgs args)
+ {
+ var file = args.File;
+ var preview = await file.RequestImageFileAsync("image/png", 100, 100);
+ await using var stream = preview.OpenReadStream();
+ var buffer = new byte[stream.Length];
+ await using var memoryStream = new MemoryStream(buffer);
+ await stream.CopyToAsync(memoryStream);
+ var base64 = Convert.ToBase64String(buffer);
+ imageBase64 = $"data:image/png;base64,{base64}";
+ }
+}
+```
+
+When using the `RequestImageFileAsync` method, the `UploadFiles` method will not be able to upload the file inside a test. Blazor has some internal checks, bUnit can not overcome easily. So the following test will fail:
+
+```csharp
+[Fact]
+public void UploadFileTest()
+{
+ var cut = Render();
+
+ cut.FindComponent().UploadFiles(InputFileContent.CreateFromBinary([1,2], "test.png"));
+
+ cut.Find("img").GetAttribute("src").Should().NotBeNullOrEmpty(); // Will fail
+ Renderer.UnhandledException.Should().BeNull(); // Will fail
+}
+```
+
+To work around this limitation, refactoring the logic into a service that is injected into the component and then mocking the service in the test is a possible solution.
\ No newline at end of file
diff --git a/docs/site/docs/toc.md b/docs/site/docs/toc.md
index 327afde06..8d937b05c 100644
--- a/docs/site/docs/toc.md
+++ b/docs/site/docs/toc.md
@@ -14,6 +14,7 @@
## [Trigger renders](xref:trigger-renders)
## [Awaiting an async state change](xref:awaiting-async-state)
## [Disposing components](xref:dispose-components)
+## [Render modes and RendererInfo](xref:render-modes)
# [Verifying output](xref:verification)
## [Verify markup](xref:verify-markup)
diff --git a/docs/site/index.md b/docs/site/index.md
index a5a62bfe9..9d0242daa 100644
--- a/docs/site/index.md
+++ b/docs/site/index.md
@@ -50,24 +50,14 @@ bUnit is available on NuGet in various incarnations. Most users should just pick
## Sponsors
-A huge thank you to the [sponsors of my work with bUnit](https://github.com/sponsors/egil). The higher tier sponsors are:
+A huge thank you to the [sponsors of bUnit](https://github.com/sponsors/egil). The higher tier sponsors are: