public void StartProduction_ThrowsExceptionWhenPassingNullReferenceArgument()
 {
     SmartWarehouse<FormattedText> warehoue = null;
     PasswordProducer pp = new PasswordProducer(new FormattedText("abc"));
     Assert.Throws(typeof(NullReferenceException), delegate()
     {
         pp.StartProduction(warehoue);
     });
 }
 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 AddProducer(PasswordProducer producer)
        {
            if (producer == null)
                throw new NullReferenceException();
            if(producers.Contains(producer))
                    throw new ArgumentException("Producer is already on list.");

            producers.Add(producer);

            lock (synchronizationObject)
            {
                if (ProductionStarted)
                    producer.StartProduction(warehouse);
            }
        }