it('adjusts throughput based on multiple throughput risks', function () {
   simParams.throughputSources = [{
     'description': 'tiny team',
     'min': '0',
     'mostLikely': '10',
     'max': '20'
   }];
   simParams.throughputRisks = [
     {
       'description': 'attrition/turnover',
       'prob': '0.5',
       'impact': '10'
     }, {
       'description': 'attrition/turnover',
       'prob': '0.25',
       'impact': '-10'
     }
   ];
   var sim = new ProjectSimulator(simParams);
   sim.validateAndCleanParameters();
   var validatedParameters = sim.validatedSimParams;
   var samples = _.times(validatedParameters.maxIterations, function () {
     return sim.throughputGenerator.generate();
   });
   expect(jStat.mean(samples)).to.be.within(12, 13);
 });
 it('generates a likely throughput between the min and max throughput', function () {
   simParams.throughputSources = [{
     'description': 'A team',
     'min': '20',
     'mostLikely': '45',
     'max': '60'
   }];
   simParams.throughputRisks = [];
   var sim = new ProjectSimulator(simParams);
   sim.validateAndCleanParameters();
   expect(sim.throughputGenerator.generate()).to.be.within(20, 60);
 });
 it('calls betaInputs only once per throughput source', function () {
   simParams.maxIterations = 10;
   simParams.throughputRisks = [];
   var sim = new ProjectSimulator(simParams);
   sim.validateAndCleanParameters();
   var validatedParameters = sim.validatedSimParams;
   var betaInputsSpy = sinon.spy(distributions, 'betaInputs');
   _.times(validatedParameters.maxIterations, function () {
     sim.throughputGenerator.generate();
   });
   expect(betaInputsSpy.callCount).to.equal(validatedParameters.throughputSources.length);
   distributions.betaInputs.restore();
 });
 it('sums multiple beta distributions for multiple throughput sources', function () {
   simParams.throughputRisks = [];
   var sim = new ProjectSimulator(simParams);
   sim.validateAndCleanParameters();
   var validatedParameters = sim.validatedSimParams;
   var throughputSamples = [];
   _.times(validatedParameters.maxIterations, function () {
     throughputSamples.push(sim.throughputGenerator.generate());
   });
   expect(throughputSamples.length).to.equal(validatedParameters.maxIterations);
   expect(jStat.min(throughputSamples)).to.be.lt(30);
   expect(jStat.max(throughputSamples)).to.be.gt(74);
 });
 it('generates an integer', function () {
   simParams.throughputSources = [{
     'description': 'A team',
     'min': '20',
     'mostLikely': '45',
     'max': '60'
   }];
   simParams.throughputRisks = [];
   var sim = new ProjectSimulator(simParams);
   sim.validateAndCleanParameters();
   var sample = sim.throughputGenerator.generate();
   expect(sample).to.be.a('number');
   expect(sample % 1).to.equal(0);
 });
 it('generates beta distributed throughput samples for a single throughput source', function () {
   simParams.throughputSources = [{
     'description': 'A team',
     'min': '20',
     'mostLikely': '45',
     'max': '60'
   }];
   simParams.throughputRisks = [];
   var sim = new ProjectSimulator(simParams);
   sim.validateAndCleanParameters();
   var validatedParameters = sim.validatedSimParams;
   var validatedThroughputSource = validatedParameters.throughputSources[0];
   var tolerance = 3;
   var throughputSamples = [];
   _.times(validatedParameters.maxIterations, function () {
     throughputSamples.push(sim.throughputGenerator.generate());
   });
   expect(throughputSamples.length).to.equal(validatedParameters.maxIterations);
   expect(jStat.min(throughputSamples)).to.be.lt(validatedThroughputSource.min + tolerance);
   expect(jStat.max(throughputSamples)).to.be.gt(validatedThroughputSource.max - tolerance);
   expect(jStat.mean(throughputSamples) - validatedThroughputSource.mostLikely).to.be.lt(0.1);
 });
 it('never allows a throughput less than zero', function () {
   simParams.throughputSources = [{
     'description': 'tiny team',
     'min': '0',
     'mostLikely': '10',
     'max': '20'
   }];
   simParams.throughputRisks = [
     {
       'description': 'attrition/turnover',
       'prob': '0.5',
       'impact': '-100'
     }
   ];
   var sim = new ProjectSimulator(simParams);
   sim.validateAndCleanParameters();
   var validatedParameters = sim.validatedSimParams;
   var samples = _.times(validatedParameters.maxIterations, function () {
     return sim.throughputGenerator.generate();
   });
   expect(jStat.mean(samples)).to.be.gt(0);
 });