public void StopProduction_SuccessfullyStopsProduction()
 {
     SmartWarehouse<FormattedText> warehouse = new SmartWarehouse<FormattedText>(20);
     PasswordProducer pp = new PasswordProducer(new FormattedText("abc"));
     Assert.DoesNotThrow(delegate()
     {
         pp.StartProduction(warehouse);
         pp.StopProduction();
     });
 }
        public void StartProduction_ThrowsExceptionWhenTryingToCallMethodWhenProductionIsNotStopped()
        {
            SmartWarehouse<FormattedText> warehouse = new SmartWarehouse<FormattedText>(20);
            PasswordDistributor distributor = new PasswordDistributor(warehouse);
            PasswordProducer producer = new PasswordProducer(new FormattedText("abc"));
            producer.PasswordAdditionMaximumTime = 20;
            distributor.AddProducer(producer);

            distributor.StartProduction();
            Assert.Throws(typeof(InvalidOperationException), delegate()
            {
                distributor.StartProduction();
            });
            producer.StopProduction();
        }