29 references to Dependency
Microsoft.AspNetCore.OpenApi.Tests (29)
Transformers\DocumentTransformerTests.cs (29)
75
var serviceCollection = new ServiceCollection().AddSingleton<
Dependency
>();
89
Assert.Equal(
Dependency
.InstantiationCount.ToString(CultureInfo.InvariantCulture), description);
94
Assert.Equal(
Dependency
.InstantiationCount.ToString(CultureInfo.InvariantCulture), description);
101
var serviceCollection = new ServiceCollection().AddTransient<
Dependency
>();
115
Assert.Equal(
Dependency
.InstantiationCount.ToString(CultureInfo.InvariantCulture), description);
120
Assert.Equal(
Dependency
.InstantiationCount.ToString(CultureInfo.InvariantCulture), document.Info.Description);
165
var serviceCollection = new ServiceCollection().AddSingleton<
Dependency
>();
171
Dependency
.InstantiationCount = 0;
174
var
service = context.ApplicationServices.GetRequiredService<
Dependency
>();
175
var
sameServiceAgain = context.ApplicationServices.GetRequiredService<
Dependency
>();
187
Assert.Equal(1,
Dependency
.InstantiationCount);
193
var serviceCollection = new ServiceCollection().AddScoped<
Dependency
>();
199
Dependency
.InstantiationCount = 0;
202
var
service = context.ApplicationServices.GetRequiredService<
Dependency
>();
203
var
sameServiceAgain = context.ApplicationServices.GetRequiredService<
Dependency
>();
214
Assert.Equal(2,
Dependency
.InstantiationCount);
220
var serviceCollection = new ServiceCollection().AddTransient<
Dependency
>();
226
Dependency
.InstantiationCount = 0;
229
var
service = context.ApplicationServices.GetRequiredService<
Dependency
>();
230
var
sameServiceAgain = context.ApplicationServices.GetRequiredService<
Dependency
>();
239
Assert.Equal(2,
Dependency
.InstantiationCount);
371
private class ActivatedTransformerWithDependency(
Dependency
dependency) : IOpenApiDocumentTransformer
376
document.Info.Description =
Dependency
.InstantiationCount.ToString(CultureInfo.InvariantCulture);