[Ignore] //TODO try a different instrumentation mechanism public void CreatedProviderHasCorrectInstrumentationListener() { SecurityCacheProviderFactory factory = new SecurityCacheProviderFactory(GetConfigurationSource()); ISecurityCacheProvider provider = factory.Create("provider1"); Assert.AreEqual(typeof(MockSecurityCacheProvider), provider.GetType()); MockSecurityCacheProvider mockProvider = (MockSecurityCacheProvider)provider; ISecurityCacheProviderInstrumentationProvider instrumentationProvider = mockProvider.GetInstrumentationProvder(); Assert.IsInstanceOfType(instrumentationProvider, typeof(SecurityCacheProviderInstrumentationProvider)); SecurityCacheProviderInstrumentationProvider castedProvider = (SecurityCacheProviderInstrumentationProvider)instrumentationProvider; using (WmiEventWatcher eventWatcher = new WmiEventWatcher(1)) { IToken token = new GuidToken(); castedProvider.FireSecurityCacheReadPerformed(SecurityEntityType.Identity, token); eventWatcher.WaitForEvents(); Assert.AreEqual(1, eventWatcher.EventsReceived.Count); Assert.AreEqual("SecurityCacheReadPerformedEvent", eventWatcher.EventsReceived[0].ClassPath.ClassName); Assert.AreEqual(SecurityEntityType.Identity.ToString(), eventWatcher.EventsReceived[0].Properties["EntityType"].Value); Assert.AreEqual("provider1", eventWatcher.EventsReceived[0].Properties["InstanceName"].Value); Assert.AreEqual(token.Value, eventWatcher.EventsReceived[0].Properties["TokenUsed"].Value); } }
public void CanCreateSecurityCacheProvider() { SecurityCacheProviderFactory factory = new SecurityCacheProviderFactory(GetConfigurationSource()); ISecurityCacheProvider provider = factory.Create("provider1"); Assert.AreEqual(typeof(MockSecurityCacheProvider), provider.GetType()); }
public void TryToCreateSecurityCacheProviderFromConfigurationWithNullName() { SecurityCacheProviderFactory factory = new SecurityCacheProviderFactory(GetConfigurationSource()); ISecurityCacheProvider provider = factory.Create(null); }
public void TryToCreateSecurityCacheProviderFromConfigurationThatDoesNotExist() { SecurityCacheProviderFactory factory = new SecurityCacheProviderFactory(GetConfigurationSource()); ISecurityCacheProvider provider = factory.Create("provider3"); }