29 references to Dependency
Microsoft.AspNetCore.OpenApi.Tests (29)
Transformers\DocumentTransformerTests.cs (29)
76
var serviceCollection = new ServiceCollection().AddSingleton<
Dependency
>();
90
Assert.Equal(
Dependency
.InstantiationCount.ToString(CultureInfo.InvariantCulture), description);
95
Assert.Equal(
Dependency
.InstantiationCount.ToString(CultureInfo.InvariantCulture), description);
102
var serviceCollection = new ServiceCollection().AddTransient<
Dependency
>();
116
Assert.Equal(
Dependency
.InstantiationCount.ToString(CultureInfo.InvariantCulture), description);
121
Assert.Equal(
Dependency
.InstantiationCount.ToString(CultureInfo.InvariantCulture), document.Info.Description);
166
var serviceCollection = new ServiceCollection().AddSingleton<
Dependency
>();
172
Dependency
.InstantiationCount = 0;
175
var
service = context.ApplicationServices.GetRequiredService<
Dependency
>();
176
var
sameServiceAgain = context.ApplicationServices.GetRequiredService<
Dependency
>();
188
Assert.Equal(1,
Dependency
.InstantiationCount);
194
var serviceCollection = new ServiceCollection().AddScoped<
Dependency
>();
200
Dependency
.InstantiationCount = 0;
203
var
service = context.ApplicationServices.GetRequiredService<
Dependency
>();
204
var
sameServiceAgain = context.ApplicationServices.GetRequiredService<
Dependency
>();
215
Assert.Equal(2,
Dependency
.InstantiationCount);
221
var serviceCollection = new ServiceCollection().AddTransient<
Dependency
>();
227
Dependency
.InstantiationCount = 0;
230
var
service = context.ApplicationServices.GetRequiredService<
Dependency
>();
231
var
sameServiceAgain = context.ApplicationServices.GetRequiredService<
Dependency
>();
240
Assert.Equal(2,
Dependency
.InstantiationCount);
372
private class ActivatedTransformerWithDependency(
Dependency
dependency) : IOpenApiDocumentTransformer
377
document.Info.Description =
Dependency
.InstantiationCount.ToString(CultureInfo.InvariantCulture);