You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: MIGRATION.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -76,3 +76,6 @@ public class HelloWorldInstancePerTestCase : Bunit.TestContext
76
76
```
77
77
78
78
Or use the `BunitContext` directly and manage the lifecycle yourself.
79
+
80
+
## `TestServiceProvider` renamed to `BunitTestServiceProvider`
81
+
The `TestServiceProvider` class has been renamed to `BunitTestServiceProvider`. If you used `TestServiceProvider`, you should replace it with `BunitTestServiceProvider`.
Copy file name to clipboardExpand all lines: docs/site/docs/providing-input/inject-services-into-components.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,11 +28,11 @@ The highlighted line shows how the `IWeatherForecastService` is registered in th
28
28
29
29
## Fallback service provider
30
30
31
-
A fallback service provider can be registered with the built-in `TestServiceProvider`. This enables a few interesting use cases, such as using an alternative IoC container (which should implement the `IServiceProvider` interface), or automatically creating mock services for your Blazor components. The latter can be achieved by using a combination of [AutoFixture](https://github.com/AutoFixture/AutoFixture) and your favorite mocking framework, e.g. Moq, NSubsitute, or Telerik JustMock.
31
+
A fallback service provider can be registered with the built-in `BunitServiceProvider`. This enables a few interesting use cases, such as using an alternative IoC container (which should implement the `IServiceProvider` interface), or automatically creating mock services for your Blazor components. The latter can be achieved by using a combination of [AutoFixture](https://github.com/AutoFixture/AutoFixture) and your favorite mocking framework, e.g. Moq, NSubsitute, or Telerik JustMock.
32
32
33
33
### When is the fallback service provider used?
34
34
35
-
The logic inside the `TestServiceProvider` for using the fallback service provider is as follows:
35
+
The logic inside the `BunitServiceProvider` for using the fallback service provider is as follows:
36
36
37
37
1. Try resolving the requested service from the standard service provider in bUnit.
38
38
2. If that fails, try resolving from a fallback service provider, if one exists.
@@ -52,7 +52,7 @@ Here is a test where the fallback service provider is used:
52
52
In this example, the `DummyService` is provided by the fallback service provider, since it is not registered in the default service provider.
53
53
54
54
## Using a custom IServiceProvider implementation
55
-
A custom service provider factory can be registered with the built-in `TestServiceProvider`. It is used to create the underlying IServiceProvider. This enables a few interesting use cases, such as using an alternative IoC container (which should implement the `IServiceProvider` interface). This approach can be useful if the fallback service provider is not an option. For example, if you have dependencies in the fallback container, that rely on dependencies which are in the main container and vice versa.
55
+
A custom service provider factory can be registered with the built-in `BunitServiceProvider`. It is used to create the underlying IServiceProvider. This enables a few interesting use cases, such as using an alternative IoC container (which should implement the `IServiceProvider` interface). This approach can be useful if the fallback service provider is not an option. For example, if you have dependencies in the fallback container, that rely on dependencies which are in the main container and vice versa.
56
56
57
57
### Registering Autofac service provider factory
58
58
The example makes use of `AutofacServiceProviderFactory` and `AutofacServiceProvider` from the package `Autofac.Extensions.DependencyInjection` and shows how to use an Autofac dependency container with bUnit.
0 commit comments