public void ShouldInvokeMethodOfTypeVoidWithValidServiceCollection() { var testPlugin = new CachingTestPlugin(); var serviceCollection = new ServiceCollection(); testPlugin.ServiceRegistrationDelegate(serviceCollection); var methodReturnType = testPlugin.ServiceRegistrationDelegate.Method.ReturnType.Name; Assert.True(methodReturnType == "Void"); Assert.Contains(serviceCollection, s => s.ServiceType == typeof(IMemoryCache)); }
public void ShouldInvokeMethodOfTypeVoidWithValidServiceCollection() { var testPlugin = new CachingTestPlugin(); var serviceCollection = new ServiceCollection(); serviceCollection.AddMemoryCache(); serviceCollection.AddDistributedMemoryCache(); testPlugin.ServiceRegistrationDelegate(serviceCollection); Assert.Contains( serviceCollection, s => s.ServiceType == typeof(IMemoryCache) && s.ImplementationType == typeof(MemoryCache)); Assert.Contains( serviceCollection, s => s.ServiceType == typeof(IDistributedCache) && s.ImplementationType == typeof(MemoryDistributedCache)); }
public void ShouldThrowArgumentNullExceptionWithInvalidServiceCollection() { var testPlugin = new CachingTestPlugin(); Assert.Throws <NullReferenceException>(() => testPlugin.ServiceRegistrationDelegate(null)); }