public PasswordProducer(PermutationGenerator generator)
        {
            if (generator == null)
                throw new NullReferenceException();
            this.generator = generator;

            PasswordAdditionMaximumTime = 1000;
        }
 public void ThrowsExceptionWhenPassingNullReferenceToConstructor()
 {
     FormattedText alphabet = null;
     Assert.Throws(typeof(NullReferenceException), delegate()
     {
         PermutationGenerator generator = new PermutationGenerator(alphabet);
     });
 }
        public void ReturnsPasswordProducerObject()
        {
            FormattedText alphabet = new FormattedText("abc");
            PasswordProducer pp = new PasswordProducer(alphabet);
            Assert.IsNotNull(pp);

            PermutationGenerator generator = new PermutationGenerator(alphabet);
            pp = new PasswordProducer(generator);
            Assert.IsNotNull(pp);
        }
        public void GenerateNext_GeneratesPasswordFromAlphabet()
        {
            FormattedText alphabet = new FormattedText("ab");
            PermutationGenerator generator = new PermutationGenerator(alphabet);
            FormattedText password = generator.GenerateNext();

            Assert.IsNotNull(password);
            Assert.AreEqual("ab", password.Text);
            password = generator.GenerateNext();
            Assert.AreEqual("ba", password.Text);
            password = generator.GenerateNext();
            Assert.AreEqual("ab", password.Text);
        }
 public void ReturnsPermutationGeneratorObject()
 {
     FormattedText alphabet = new FormattedText("abc");
     PermutationGenerator generator = new PermutationGenerator(alphabet);
     Assert.IsNotNull(generator);
 }