using Microsoft.Extensions.DependencyInjection; namespace PracticeCalendar.UnitTests.Integration { public static class ServiceCollectionExtensions { public static IServiceCollection Remove(this IServiceCollection services) { var serviceDescriptor = services.FirstOrDefault(d => d.ServiceType == typeof(TService)); if (serviceDescriptor != null) { services.Remove(serviceDescriptor); } return services; } } }