mirror of
https://github.com/farcasclaudiu/PracticeCalendar.git
synced 2026-06-22 09:01:18 +03:00
nice refactorings
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace PracticeCalendar.UnitTests.Integration
|
||||
{
|
||||
public static class ServiceCollectionExtensions
|
||||
{
|
||||
public static IServiceCollection Remove<TService>(this IServiceCollection services)
|
||||
{
|
||||
var serviceDescriptor = services.FirstOrDefault(d =>
|
||||
d.ServiceType == typeof(TService));
|
||||
|
||||
if (serviceDescriptor != null)
|
||||
{
|
||||
services.Remove(serviceDescriptor);
|
||||
}
|
||||
|
||||
return services;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user