public void InitializedTest5() { try { ServiceLocatorWrapper.Reset(); _unityServiceLocator = new UnityServiceLocator( new UnityContainer() /*.RegisterInstance<string>(Algorithms.Hash.ResolveName, "SHA1")*/ /*.RegisterType<HashAlgorithm, SHA512Cng>()*/); ServiceLocator.SetLocatorProvider(() => _unityServiceLocator); var target = new HashAlgorithmFactory(); target.Initialize("SHA384"); var hasher = target.Create(); Assert.IsNotNull(hasher); Assert.IsInstanceOfType(hasher, typeof(SHA384)); } finally { CleanupTest(); } }
public void InitializedTest5() { try { ServiceLocatorWrapper.Reset(); _unityServiceLocator = new UnityServiceLocator( new UnityContainer() /*.RegisterInstance<string>(Algorithms.Symmetric.ResolveName, "DES")*/ /*.RegisterType<Symmetric, TripleDESCryptoServiceProvider>()*/); ServiceLocator.SetLocatorProvider(() => _unityServiceLocator); var target = new SymmetricAlgorithmFactory(); target.Initialize("RC2"); var symmetric = target.Create(); Assert.IsNotNull(symmetric); Assert.IsInstanceOfType(symmetric, typeof(RC2)); } finally { CleanupTest(); } }
public static void InitializeHashAlgorithmTest() { ServiceLocatorWrapper.Reset(); _unityServiceLocator = new UnityServiceLocator( new UnityContainer() .RegisterType <HashAlgorithm, MD5Cng>()); ServiceLocator.SetLocatorProvider(() => _unityServiceLocator); }
public static void InitializeHashNameTest(string name) { ServiceLocatorWrapper.Reset(); _unityServiceLocator = new UnityServiceLocator( new UnityContainer() .RegisterInstance <string>(Algorithms.Hash.ResolveName, name)); ServiceLocator.SetLocatorProvider(() => _unityServiceLocator); }
public static void InitializeSymmetricAlgorithmTest() { ServiceLocatorWrapper.Reset(); _unityServiceLocator = new UnityServiceLocator( new UnityContainer() .RegisterType <SymmetricAlgorithm, Rijndael>()); ServiceLocator.SetLocatorProvider(() => _unityServiceLocator); }
public static void CleanupTest() { ServiceLocator.SetLocatorProvider(null); if (_unityServiceLocator != null) { _unityServiceLocator.Dispose(); } ServiceLocatorWrapper.Reset(); }