Exemplo n.º 1
0
        public void When_DeregisteringAlgorithm_Expect_NoLongerSearchable()
        {
            PasswordAlgorithmRepo.RegisterAlgorithm(algorithm);

            var myAlgorithm = PasswordAlgorithmRepo.Get(algorithm.AlgorithmId);

            Assert.IsNotNull(myAlgorithm);
            Assert.AreSame(algorithm, myAlgorithm);

            PasswordAlgorithmRepo.DeregisterAlgorithm(algorithm.AlgorithmId);

            Assert.Throws <PasswordHashException>(() => PasswordAlgorithmRepo.Get(algorithm.AlgorithmId), $"The given algorithm ID '{algorithm.AlgorithmId}' was not found in the repo.");
            Assert.IsFalse(PasswordAlgorithmRepo.Search(algorithm.AlgorithmId, true).Any());
        }