File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed
tests/Components/TestComponentBaseTest Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,11 @@ public ServiceDescriptor this[int index]
4444 }
4545 }
4646
47+ /// <summary>
48+ /// Creates an instance of the <see cref="TestServiceProvider"/> and sets its service collection to the
49+ /// provided <paramref name="initialServiceCollection"/>, if any.
50+ /// </summary>
51+ /// <param name="initialServiceCollection"></param>
4752 public TestServiceProvider ( IServiceCollection ? initialServiceCollection = null ) : this ( initialServiceCollection ?? new ServiceCollection ( ) , false )
4853 {
4954 }
Original file line number Diff line number Diff line change 11@inherits TestComponentBase
22@using Shouldly
33
4- <SnapshotTest Setup =" () => Services" >
4+ @code {
5+ class Dep1 : ITestDep { public string Name { get ; } = " FOO" ; }
6+ class Dep2 : IAsyncTestDep { public Task <string > GetData () => Task .FromResult (" BAR" ); }
7+ }
8+
9+ <SnapshotTest Setup =" () => Services.AddSingleton<ITestDep, Dep1>()"
10+ SetupAsync =" () => { Services.AddSingleton<IAsyncTestDep, Dep2>(); return Task.CompletedTask; }" >
511 <TestInput >
612 <SimpleWithDeps ></SimpleWithDeps >
713 <SimpleWithAyncDeps ></SimpleWithAyncDeps >
814 </TestInput >
915 <ExpectedOutput >
10- @inject ITestDep testDep
11- <p >@testDep.Name </p >
16+ < p >FOO</ p >
17+ <p >BAR </p >
1218 </ExpectedOutput >
1319</SnapshotTest >
You can’t perform that action at this time.
0 commit comments