public void AddDistributedSqlServerCache_WithNullServicesCollection_ShouldThrowArgumentNullException() { MySqlServerCachingServicesExtensions.AddDistributedMySqlServerCache(null, options => { options.ConnectionString = "Server=example.com;Database=db;User=root;"; options.TableName = "MyTable"; }); }
public void AddDistributedSqlServerCache_AddsAsSingleRegistrationService() { // Arrange var services = new ServiceCollection(); // Act MySqlServerCachingServicesExtensions.AddMySqlCacheServices(services); // Assert Assert.True(1 == services?.Count); var serviceDescriptor = services[0]; Assert.Equal(typeof(IDistributedCache), serviceDescriptor.ServiceType); Assert.Equal(typeof(MySqlCache), serviceDescriptor.ImplementationType); Assert.Equal(ServiceLifetime.Singleton, serviceDescriptor.Lifetime); }