public void AddSpotToBreakValidatorService_ValidateAddSpot_ReturnsCampaignClashFailure() { // Arrange SetupTestData( out IReadOnlyCollection<Break> breaksBeingSmoothed, out SmoothBreak theSmoothBreak, out IReadOnlyCollection<Programme> scheduleProgrammes, out List<Spot> spotsForBreak, out SalesArea salesArea, out IReadOnlyDictionary<string, Clash> clashesByExternalRef, out IReadOnlyDictionary<Guid, SpotInfo> spotInfos, out ProductClashRules productClashRule, out SmoothResources smoothResources, out IClashExposureCountService clashExposureCountService, out SponsorshipRestrictionService sponsorshipRestrictionsService); _ = theSmoothBreak.AddSpot( (Spot)_spot.Clone(), 1, 1, 1, true, false, String.Empty, String.Empty); // Act var res = AddSpotsToBreakValidatorService.ValidateAddSpots( theSmoothBreak, programme: scheduleProgrammes.First(), salesArea: salesArea, spotsForBreak: spotsForBreak, spotInfos: spotInfos, progSmoothBreaks: new List<SmoothBreak> { theSmoothBreak }, productClashRule: productClashRule, respectCampaignClash: true, respectSpotTime: false, respectRestrictions: false, respectClashExceptions: false, breakPositionRules: SpotPositionRules.Exact, requestedPositionInBreakRules: SpotPositionRules.Exact, clashesByExternalRef: clashesByExternalRef, canSplitMultipartSpotsOverBreaks: false, smoothResources: smoothResources, breaksBeingSmoothed: breaksBeingSmoothed, scheduleProgrammes: scheduleProgrammes, clashExposureCountService: clashExposureCountService, sponsorshipRestrictionsService: sponsorshipRestrictionsService); // Assert AssertFailureMessage(res, SmoothFailureMessages.T1_CampaignClash); }
[InlineData(null, false, "2018-07-30T20:00:00", "")] // spot break request is empty string public void AddSpotToBreakValidatorService_ValidateAddSpot_ReturnsNoFailures( string spotBreakType, bool respectSpotTime, DateTime spotEndDateTime, string spotBreakRequest ) { // Arrange SetupTestData( out IReadOnlyCollection<Break> breaksBeingSmoothed, out SmoothBreak theSmoothBreak, out IReadOnlyCollection<Programme> scheduleProgrammes, out List<Spot> spotsForBreak, out SalesArea salesArea, out IReadOnlyDictionary<string, Clash> clashesByExternalRef, out IReadOnlyDictionary<Guid, SpotInfo> spotInfos, out ProductClashRules productClashRule, out SmoothResources smoothResources, out IClashExposureCountService clashExposureCountService, out SponsorshipRestrictionService sponsorshipRestrictionsService); spotsForBreak[0].BreakType = spotBreakType; spotsForBreak[0].EndDateTime = spotEndDateTime; var placedSpot = (Spot)_spot.Clone(); placedSpot.ExternalCampaignNumber = nameof(_spot.ExternalCampaignNumber); _ = theSmoothBreak.AddSpot( placedSpot, 1, 1, 1, true, false, String.Empty, String.Empty); spotsForBreak[0].BreakRequest = spotBreakRequest; // Act var res = AddSpotsToBreakValidatorService.ValidateAddSpots( theSmoothBreak, programme: scheduleProgrammes.First(), salesArea: salesArea, spotsForBreak: spotsForBreak, spotInfos: spotInfos, progSmoothBreaks: new List<SmoothBreak> { theSmoothBreak }, productClashRule: productClashRule, respectCampaignClash: true, respectSpotTime: respectSpotTime, respectRestrictions: false, respectClashExceptions: false, breakPositionRules: SpotPositionRules.Exact, requestedPositionInBreakRules: SpotPositionRules.Exact, clashesByExternalRef: clashesByExternalRef, canSplitMultipartSpotsOverBreaks: false, smoothResources: smoothResources, breaksBeingSmoothed: breaksBeingSmoothed, scheduleProgrammes: scheduleProgrammes, clashExposureCountService: clashExposureCountService, sponsorshipRestrictionsService: sponsorshipRestrictionsService); // Assert _ = res.Should().ContainSingle(); _ = res.First().Value.Failures.Should().BeEmpty(); }