public void Run() { do { var corralNames = workflowEngine.Corrals.Select(x => x.Name); var selectedCorral = SelectCorral(corralNames); string selectedCriteria = null; if (selectedCorral != "N") { selectedCriteria = SelectCriteria(selectedCorral); } if (selectedCorral == "N" || selectedCriteria == "N") { workflowEngine.Distribute(); Console.WriteLine("Visualise Runner, Pick a Cooral: "); foreach (var corral in workflowEngine.Corrals) { Console.WriteLine( $"[{corral.Name}] Max Runners: {corral.MaxElements} Current Runner : {corral.Count}"); } } else { ConfigureCorralCriteria(selectedCorral, selectedCriteria); } } while (true); }
public void WhenNoCriteriaIsApplied_ShouldUseDefaultCriteriaForAllCorrals() { var runnerCount = 1000; var runners = _fixture.CreateMany <Runner>(runnerCount).ToArray(); _runnerGeneratorMock.Setup(x => x.Generate(It.IsAny <int>())) .Returns(runners); _workflowEngine.Distribute(); var corralA = _workflowEngine.Corrals.Single(x => x.Name == "A"); var corralB = _workflowEngine.Corrals.Single(x => x.Name == "B"); var corralC = _workflowEngine.Corrals.Single(x => x.Name == "C"); Assert.Equal(corralA.MaxElements, corralA.Count); Assert.Equal(corralB.MaxElements, corralB.Count); Assert.Equal(runnerCount - corralA.MaxElements - corralB.MaxElements, corralC.Count); }