Exemplo n.º 1
0
        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);
            
        }
Exemplo n.º 3
0
        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");
        }
Exemplo n.º 4
0
 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");
        }
Exemplo n.º 6
0
		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;
			}
		}