public void AddBandwidthTest2() { var context = new MockContext <IServiceCollection>(); context.Arrange(s => s.Add(The <ServiceDescriptor> .IsAnyValue)); var serviceCollection = new MockServiceCollection(context); var list = new List <object>(); serviceCollection.AddBandwidth(new BandwidthAuthData { UserId = "userId", ApiToken = "apiToken", ApiSecret = "apiSecret" }, (type, i) => list.Add(i)); Assert.Equal(17, list.Count); }
public void AddBandwidthTest() { var context = new MockContext <IServiceCollection>(); context.Arrange(s => s.Add(The <ServiceDescriptor> .Is(d => CheckServiceDescriptor(d)))); var serviceCollection = new MockServiceCollection(context); serviceCollection.AddBandwidth(new BandwidthAuthData { UserId = "userId", ApiToken = "apiToken", ApiSecret = "apiSecret" }); Assert.True(serviceCollection.Count > 0); Assert.NotNull(serviceCollection.FirstOrDefault(d => d.ServiceType == typeof(IMemoryCache))); }