public void ProviderRegistry_ExcludeProviderTwice_ThrowsArgumentException() { // Arrange var registry = new ProviderRegistry(); var providers = new List <IProvider>(); var toBeIncluded = new Provider("0"); var toBeExcluded = new Provider("1"); providers.Add(toBeIncluded); providers.Add(toBeExcluded); registry.Register(providers); // Act registry.Exclude(toBeExcluded); var ex = Assert.Throws <ArgumentException>(() => registry.Exclude(toBeExcluded)); Assert.AreEqual("Provider is not registered so it can't be excluded", ex.Message); }
public void ProviderRegistry_ExcludeProvider_DoesntShowUpInProviders() { // Arrange var registry = new ProviderRegistry(); var providers = new List <IProvider>(); var toBeIncluded = new Provider("0"); var toBeExcluded = new Provider("1"); providers.Add(toBeIncluded); providers.Add(toBeExcluded); registry.Register(providers); // Act registry.Exclude(toBeExcluded); Assert.AreEqual(1, registry.ActiveProviders.Count); Assert.AreEqual(toBeIncluded, registry.ActiveProviders.First()); Assert.AreEqual(toBeExcluded, registry.ExcludedProviders.First()); }