Beispiel #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);
        }
Beispiel #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 GivenTheProductsAreAssignedToClashCodesAndAdvertiserIdentifierWhenTheRestrictionValuesAreSetForEachCode_ThenTheProductsWithMoreRestrictionValuesAssignToThemGetTheMinimumRestrictionValue()
        {
            var runningTotal = new SmoothSponsorshipRunningTotals();

            runningTotal.AddCompetitorToClashCode("p1", "c1");
            runningTotal.AddCompetitorToClashCode("p2", "c1");
            runningTotal.AddCompetitorToClashCode("p1", "c2");
            runningTotal.AddCompetitorToAdvertiserIdentifier("p1", "a1");
            runningTotal.AddCompetitorToAdvertiserIdentifier("p2", "a1");
            runningTotal.AddCompetitorToAdvertiserIdentifier("p1", "a2");

            runningTotal.SetRestrictionValueForClashCode("c1", 10);
            runningTotal.SetRestrictionValueForClashCode("c2", 20);
            runningTotal.SetRestrictionValueForClashCode("c1", 1);
            runningTotal.SetRestrictionValueForClashCode("c2", 2);
            runningTotal.SetRestrictionValueForClashCode("a1", 100);
            runningTotal.SetRestrictionValueForClashCode("a2", 200);
            runningTotal.SetRestrictionValueForClashCode("a1", 10);
            runningTotal.SetRestrictionValueForClashCode("a2", 20);

            var restrictionValuesForCompetitors = runningTotal.GetRestrictionValuesForCompetitors();

            Assert.Equal(new ProductExternalReference[] { "p1", "p2", "c1", "c2", "a1", "a2" }, restrictionValuesForCompetitors.Keys.ToArray());
            Assert.Equal(1, restrictionValuesForCompetitors["p1"]);
            Assert.Equal(1, restrictionValuesForCompetitors["p2"]);
            Assert.Equal(1, restrictionValuesForCompetitors["c1"]);
            Assert.Equal(2, restrictionValuesForCompetitors["c2"]);
            Assert.Equal(10, restrictionValuesForCompetitors["a1"]);
            Assert.Equal(20, restrictionValuesForCompetitors["a2"]);
        }
Beispiel #4
0
        private static SmoothSponsorshipRunningTotals GetSampleDataForEachCompetitorWithLessThanOneAvailibityForCompetitorWhenCalculationTypeIsPercentage()
        {
            var input = new SmoothSponsorshipRunningTotals();

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

            input.SetRestrictionValueForClashCode("P330", 9);
            input.SetRestrictionValueForClashCode("P200", 4);

            input.AddSponsoredProductToSpotByCount("P1", 10);

            return(input);
        }
Beispiel #5
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);
        }
        internal void GivenRestrictionValuesAreAddedToSomeClashAndAdvertiserCodes_TheAllRestrictionValuesWillContainsAllTheValues()
        {
            var runningTotal = new SmoothSponsorshipRunningTotals();

            runningTotal.SetRestrictionValueForClashCode("c1", 10);
            runningTotal.SetRestrictionValueForClashCode("c2", 20);
            runningTotal.SetRestrictionValueForClashCode("c1", 1);
            runningTotal.SetRestrictionValueForClashCode("c2", 2);
            runningTotal.SetRestrictionValueForClashCode("a1", 100);
            runningTotal.SetRestrictionValueForClashCode("a2", 200);
            runningTotal.SetRestrictionValueForClashCode("a1", 10);
            runningTotal.SetRestrictionValueForClashCode("a2", 20);

            Assert.Equal(new string[] { "c1", "c2", "a1", "a2" }, runningTotal.AllRestrictionValues.Keys.ToArray());
            Assert.Equal(1, runningTotal.AllRestrictionValues["c1"]);
            Assert.Equal(2, runningTotal.AllRestrictionValues["c2"]);
            Assert.Equal(10, runningTotal.AllRestrictionValues["a1"]);
            Assert.Equal(20, runningTotal.AllRestrictionValues["a2"]);
        }
        internal void GivenNoProductsAreAssignedToClashCodesAndAdvertiserIdentifierWhenTheRestrictionValuesAreSetForEachCodeClashAndAdvertiserThenTheClashesAndAdvertisersWillBeInTheRrestrictionValue()
        {
            var runningTotal = new SmoothSponsorshipRunningTotals();

            runningTotal.SetRestrictionValueForClashCode("c1", 10);
            runningTotal.SetRestrictionValueForClashCode("c2", 20);
            runningTotal.SetRestrictionValueForClashCode("c1", 1);
            runningTotal.SetRestrictionValueForClashCode("c2", 2);
            runningTotal.SetRestrictionValueForClashCode("a1", 100);
            runningTotal.SetRestrictionValueForClashCode("a2", 200);
            runningTotal.SetRestrictionValueForClashCode("a1", 10);
            runningTotal.SetRestrictionValueForClashCode("a2", 20);

            var restrictionValuesForCompetitors = runningTotal.GetRestrictionValuesForCompetitors();

            Assert.Equal(new ProductExternalReference[] { "c1", "c2", "a1", "a2" }, restrictionValuesForCompetitors.Keys.ToArray());
            Assert.Equal(1, restrictionValuesForCompetitors["c1"]);
            Assert.Equal(2, restrictionValuesForCompetitors["c2"]);
            Assert.Equal(10, restrictionValuesForCompetitors["a1"]);
            Assert.Equal(20, restrictionValuesForCompetitors["a2"]);
        }
Beispiel #8
0
        private static SmoothSponsorshipRunningTotals GetSampleDataForEachCompetitorWithCompetitorsAvalibityInDecimalWhenCalculationTypeIsPercentage()
        {
            var input = new SmoothSponsorshipRunningTotals();

            input.AddCompetitorToClashCode("C1", "P1");
            input.AddCompetitorToClashCode("C2", "P2");
            input.AddCompetitorToClashCode("C3", "P3");
            input.AddCompetitorToClashCode("C4", "P4");
            input.AddCompetitorToClashCode("C5", "P5");
            input.AddCompetitorToClashCode("C6", "P6");
            input.AddCompetitorToClashCode("C7", "P7");
            input.AddCompetitorToClashCode("C8", "P8");
            input.AddCompetitorToClashCode("C9", "P9");
            input.AddCompetitorToClashCode("C10", "P10");
            input.AddCompetitorToClashCode("C11", "P11");
            input.AddCompetitorToClashCode("C12", "P12");
            input.AddCompetitorToClashCode("C13", "P13");

            input.SetRestrictionValueForClashCode("P1", 9);
            input.SetRestrictionValueForClashCode("P2", 10);
            input.SetRestrictionValueForClashCode("P3", 11);
            input.SetRestrictionValueForClashCode("P4", 12);
            input.SetRestrictionValueForClashCode("P5", 13);
            input.SetRestrictionValueForClashCode("P6", 14);
            input.SetRestrictionValueForClashCode("P7", 15);
            input.SetRestrictionValueForClashCode("P8", 16);
            input.SetRestrictionValueForClashCode("P9", 17);
            input.SetRestrictionValueForClashCode("P10", 18);
            input.SetRestrictionValueForClashCode("P11", 19);
            input.SetRestrictionValueForClashCode("P12", 20);
            input.SetRestrictionValueForClashCode("P13", 21);

            input.AddSponsoredProductToSpotByCount("SponsoredProduct", 10);

            return(input);
        }