Skip to content

Commit 516ccaa

Browse files
committed
Add method to add a service and implementation
1 parent 56def5b commit 516ccaa

File tree

1 file changed

+6
-0
lines changed
  • IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework

1 file changed

+6
-0
lines changed

IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework/TestBuilder.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,12 @@ public TestBuilder AddDependencyInstance(object objToAdd)
9292
return this;
9393
}
9494

95+
public TestBuilder AddDependencyInstance<T>(object objToAdd)
96+
{
97+
Services.AddSingleton(typeof(T), objToAdd);
98+
return this;
99+
}
100+
95101
// Are there other cases where we'll need to add something at this level?
96102
// If so, this shouldn't be called "AddLogger".
97103
// Might need to make this scoped. It's behaving oddly when running tests in parallel

0 commit comments

Comments
 (0)