public HashProviderHelper(Func <IHashAlgorithmInstrumentationProvider, IHashProvider> defaultHashProviderFunc, Func <IHashAlgorithmInstrumentationProvider, IHashProvider> saltedHashProviderFunc) { defaultHashProviderListener = new MockHashInstrumentationListener(); this.defaultHashProvider = defaultHashProviderFunc(defaultHashProviderListener); saltedHashProviderListener = new MockHashInstrumentationListener(); this.saltedHashProvider = saltedHashProviderFunc(saltedHashProviderListener); }
public HashProviderHelper(Func<IHashAlgorithmInstrumentationProvider, IHashProvider> defaultHashProviderFunc, Func<IHashAlgorithmInstrumentationProvider, IHashProvider> saltedHashProviderFunc) { defaultHashProviderListener = new MockHashInstrumentationListener(); this.defaultHashProvider = defaultHashProviderFunc(defaultHashProviderListener); saltedHashProviderListener = new MockHashInstrumentationListener(); this.saltedHashProvider = saltedHashProviderFunc(saltedHashProviderListener); }
private void CheckEvents(MockHashInstrumentationListener listener, int failed, int created, int compared, int mismatched) { if (listener == null) { return; } Assert.AreEqual(failed, listener.GetNotificationTally("CyptographicOperationFailed"), "CyptographicOperationFailed"); Assert.AreEqual(created, listener.GetNotificationTally("HashOperationPerformed"), "HashOperationPerformed"); Assert.AreEqual(compared, listener.GetNotificationTally("HashComparisonPerformed"), "HashComparisonPerformed"); Assert.AreEqual(mismatched, listener.GetNotificationTally("HashMismatchDetected"), "HashMismatchDetected"); }
private void BindNewInstrumentationListener(IHashProvider hashProvider, out MockHashInstrumentationListener hashInstrumentationListener) { if (hashProvider is HashAlgorithmProvider) { hashInstrumentationListener = new MockHashInstrumentationListener(); new ReflectionInstrumentationBinder().Bind((hashProvider as HashAlgorithmProvider).GetInstrumentationEventProvider(), hashInstrumentationListener); } else { hashInstrumentationListener = null; } }
void CheckEvents(MockHashInstrumentationListener listener, int failed, int created, int compared, int mismatched) { if (listener == null) return; Assert.AreEqual(failed, listener.GetNotificationTally("CyptographicOperationFailed"), "CyptographicOperationFailed"); Assert.AreEqual(created, listener.GetNotificationTally("HashOperationPerformed"), "HashOperationPerformed"); Assert.AreEqual(compared, listener.GetNotificationTally("HashComparisonPerformed"), "HashComparisonPerformed"); Assert.AreEqual(mismatched, listener.GetNotificationTally("HashMismatchDetected"), "HashMismatchDetected"); }
private void BindNewInstrumentationListener(IHashProvider hashProvider, out MockHashInstrumentationListener hashInstrumentationListener) { if (hashProvider is HashAlgorithmProvider) { hashInstrumentationListener = new MockHashInstrumentationListener(); new ReflectionInstrumentationBinder().Bind((hashProvider as HashAlgorithmProvider).GetInstrumentationEventProvider(), hashInstrumentationListener); } else { hashInstrumentationListener = null; } }