public void SingleScenarioWithExcludedCampaignsAndOptimisationSuccess() { // Arrange var firstScenario = _dummyScenarios.First(); _dummyCampaignPassPriorities.ForEach(cpp => cpp.Campaign.IncludeOptimisation = true); _dummyCampaignPassPriorities.First().PassPriorities.ForEach(o => o.Priority = 0); firstScenario.Value.CampaignPassPriorities = _dummyCampaignPassPriorities; _ = _mockScenarioRepository.Setup(o => o.Get(firstScenario.Key)).Returns(firstScenario.Value); _dummyRun.Scenarios = _dummyRun.Scenarios.Where(o => o.Id == firstScenario.Key).ToList(); var expectedCampaigns = _dummyCampaigns .Where(x => x.CustomId != _dummyCampaignPassPriorities.First().Campaign.CustomId) .ToList(); // Act var resultCampaigns = OptimiserInputFilesHelper.FilterOutExcludedCampaigns(_mockScenarioRepository.Object, _dummyRun, _dummyCampaigns); // Assert _ = resultCampaigns.Should() .NotBeNullOrEmpty(becauseArgs: null) .And.HaveCount(_dummyCampaigns.Count - 1, becauseArgs: null) .And.Equal(expectedCampaigns, becauseArgs: null); }
public void MultipleScenariosWithOverlappingExcludedCampaignsAndOptimisationSuccess() { // Arrange _dummyCampaignPassPriorities.First().PassPriorities.ForEach(o => o.Priority = 0); foreach (var key in _dummyScenarios.Keys) { _dummyScenarios[key].CampaignPassPriorities = _dummyCampaignPassPriorities; _dummyScenarios[key].CampaignPassPriorities.ForEach(cpp => cpp.Campaign.IncludeOptimisation = true); _ = _mockScenarioRepository.Setup(o => o.Get(key)).Returns(_dummyScenarios[key]); } var expectedCampaigns = _dummyCampaigns .Where(x => x.CustomId != _dummyCampaignPassPriorities.First().Campaign.CustomId) .ToList(); // Act var resultCampaigns = OptimiserInputFilesHelper.FilterOutExcludedCampaigns(_mockScenarioRepository.Object, _dummyRun, _dummyCampaigns); // Assert _ = resultCampaigns.Should() .NotBeNullOrEmpty(becauseArgs: null) .And.HaveCount(_dummyCampaigns.Count - 1, becauseArgs: null) .And.Equal(expectedCampaigns, becauseArgs: null); }
public void MultipleScenariosWithNoOverlappingExcludedCampaignsSuccess() { // Arrange int i = 0; foreach (var key in _dummyScenarios.Keys) { var tempListCampaignPassPriority = new List <CampaignPassPriority>(); for (var x = 0; x < _dummyCampaigns.Count; x++) { var priority = x == i ? 0 : 999; tempListCampaignPassPriority.Add(BuildCampaignPassPriority(priority, _dummyCampaigns[x].CustomId)); } i++; _dummyScenarios[key].CampaignPassPriorities = tempListCampaignPassPriority; _ = _mockScenarioRepository.Setup(o => o.Get(key)).Returns(_dummyScenarios[key]); } // Act var resultCampaigns = OptimiserInputFilesHelper.FilterOutExcludedCampaigns(_mockScenarioRepository.Object, _dummyRun, _dummyCampaigns); // Assert _ = resultCampaigns.Should() .NotBeNullOrEmpty(becauseArgs: null) .And.HaveCount(_dummyCampaigns.Count, becauseArgs: null) .And.Equal(_dummyCampaigns, becauseArgs: null); }
public void MultipleScenariosWithNoExcludedCampaignsSuccess() { // Act var resultCampaigns = OptimiserInputFilesHelper.FilterOutExcludedCampaigns(_mockScenarioRepository.Object, _dummyRun, _dummyCampaigns); // Assert _ = resultCampaigns.Should() .NotBeNullOrEmpty(becauseArgs: null) .And.HaveCount(_dummyCampaigns.Count, becauseArgs: null) .And.Equal(_dummyCampaigns, becauseArgs: null); }
public void MultipleScenariosWithOverlappingExcludedCampaignsAndIncludeRightsizerSuccess() { // Arrange _dummyCampaignPassPriorities.First().PassPriorities.ForEach(o => o.Priority = 0); foreach (var key in _dummyScenarios.Keys) { _dummyScenarios[key].CampaignPassPriorities = _dummyCampaignPassPriorities; _dummyScenarios[key].CampaignPassPriorities.ForEach(cpp => cpp.Campaign.IncludeRightSizer = IncludeRightSizer.CampaignLevel); _ = _mockScenarioRepository.Setup(o => o.Get(key)).Returns(_dummyScenarios[key]); } // Act var resultCampaigns = OptimiserInputFilesHelper.FilterOutExcludedCampaigns(_mockScenarioRepository.Object, _dummyRun, _dummyCampaigns); // Assert _ = resultCampaigns.Should() .NotBeNullOrEmpty(becauseArgs: null) .And.HaveCount(_dummyCampaigns.Count, becauseArgs: null) .And.Equal(_dummyCampaigns, becauseArgs: null); }