Ejemplo n.º 1
0
        private static SmoothSponsorshipRunningTotals GetSampleDataForEachCompetitorWithNoSponsoredWhenCalculationTypeIsPercentage()
        {
            var input = new SmoothSponsorshipRunningTotals();

            input.AddCompetitorToClashCode("C1", "P330");
            input.AddCompetitorToClashCode("C2", "P330");
            input.AddCompetitorToClashCode("C3", "P330");

            input.AddCompetitorToClashCode("C1", "P220");
            input.AddCompetitorToClashCode("C2", "P220");
            input.AddCompetitorToClashCode("C3", "P220");

            input.AddCompetitorToAdvertiserIdentifier("C1", "A110");
            input.AddCompetitorToAdvertiserIdentifier("C4", "A110");
            input.AddCompetitorToAdvertiserIdentifier("C5", "A110");

            input.AddCompetitorToAdvertiserIdentifier("C1", "A20");
            input.AddCompetitorToAdvertiserIdentifier("C6", "A20");
            input.AddCompetitorToAdvertiserIdentifier("C7", "A20");

            input.SetRestrictionValueForClashCode("P330", 10);
            input.SetRestrictionValueForClashCode("P220", 11);
            input.SetRestrictionValueForAdvertiserIdentifier("A110", 5);
            input.SetRestrictionValueForAdvertiserIdentifier("A20", 3);

            input.AddCompetitorToSpotByCount("C1", 1);
            input.AddCompetitorToSpotByCount("C2", 1);
            input.AddCompetitorToSpotByCount("C5", 2);

            return(input);
        }
Ejemplo n.º 2
0
        private static SmoothSponsorshipRunningTotals GetSampleDataForAllCompetitorsWhenCalculationTypeIsFlat()
        {
            var input = new SmoothSponsorshipRunningTotals();

            input.AddCompetitorToClashCode("C1", "P330");
            input.AddCompetitorToClashCode("C2", "P330");
            input.AddCompetitorToClashCode("C3", "P330");

            input.AddCompetitorToClashCode("C1", "P220");
            input.AddCompetitorToClashCode("C2", "P220");
            input.AddCompetitorToClashCode("C3", "P220");

            input.AddCompetitorToAdvertiserIdentifier("C1", "A110");
            input.AddCompetitorToAdvertiserIdentifier("C4", "A110");
            input.AddCompetitorToAdvertiserIdentifier("C5", "A110");

            input.AddCompetitorToAdvertiserIdentifier("C1", "A20");
            input.AddCompetitorToAdvertiserIdentifier("C6", "A20");
            input.AddCompetitorToAdvertiserIdentifier("C7", "A20");

            input.SetRestrictionValueForClashCode("P330", 5);
            input.SetRestrictionValueForClashCode("P220", 5);
            input.SetRestrictionValueForAdvertiserIdentifier("A110", 5);
            input.SetRestrictionValueForAdvertiserIdentifier("A20", 5);

            input.AddCompetitorToSpotByCount("C1", 1);
            input.AddCompetitorToSpotByCount("C5", 2);

            input.AddSponsoredProductToSpotByCount("SP1", 1);
            input.AddSponsoredProductToSpotByCount("SP2", 1);
            input.AddSponsoredProductToSpotByCount("SP3", 1);

            return(input);
        }
        internal void GivenCompetitorsAreBeingAddedAndRemovedFromTheSpotsByCount_TheAlreadyPlacedCompetitorsWillContainsAllCompetitorsValuesInTheSpots()
        {
            var runningTotal = new SmoothSponsorshipRunningTotals();

            runningTotal.AddCompetitorToSpotByCount("p1", 1);
            runningTotal.AddCompetitorToSpotByCount("p2", 1);
            runningTotal.AddCompetitorToSpotByCount("p3", 1);
            runningTotal.AddCompetitorToSpotByCount("p1", 10);
            runningTotal.AddCompetitorToSpotByCount("p2", 1);
            runningTotal.RemoveCompetitorToSpotByCount("p1", 3);
            runningTotal.RemoveCompetitorToSpotByCount("p3", 1);
            runningTotal.RemoveCompetitorToSpotByCount("p4", 1);

            Assert.Equal(new ProductExternalReference[] { "p1", "p2" }, runningTotal.AlreadyPlacedCompetitors.Keys.ToArray());
            Assert.Equal(8, runningTotal.AlreadyPlacedCompetitors["p1"]);
            Assert.Equal(2, runningTotal.AlreadyPlacedCompetitors["p2"]);
        }
Ejemplo n.º 4
0
        private static SmoothSponsorshipRunningTotals GetSampleDataForAllCompetitorsWhenCalculationTypeIsPercentage()
        {
            var input = new SmoothSponsorshipRunningTotals();

            input.AddCompetitorToClashCode("C1", "P330");
            input.AddCompetitorToClashCode("C2", "P330");

            input.SetRestrictionValueForClashCode("P330", 10);

            input.AddCompetitorToSpotByCount("C1", 1);
            input.AddCompetitorToSpotByCount("C2", 1);

            input.AddSponsoredProductToSpotByCount("P1", 20);
            input.AddSponsoredProductToSpotByCount("P2", 30);

            return(input);
        }