public void TargettingBitInfoType_Usr_Test() { Common.Automation.Sql.Database db = new Common.Automation.Sql.Database(Common.Properties.ConnectionString); db.ExecuteScalar("DELETE FROM Banner"); Bobs.Banner b = new Bobs.Banner() { DisplayType = Bobs.Banner.DisplayTypes.CustomHtml }; b.Update(); RequestRules rr = new RequestRules(); Assert.AreEqual(1, rr.GetBannersSatsfyingQueryConditionsInTimeslot(Timeslots.GetCurrentTimeslot()).Count); BannerIsNotHtmlRule r = new BannerIsNotHtmlRule(); rr.Add(r); Assert.AreEqual(0, rr.GetBannersSatsfyingQueryConditionsInTimeslot(Timeslots.GetCurrentTimeslot()).Count); }
public void TargettingBitInfoType_Demographics_Test1() { Common.Automation.Sql.Database db = new Common.Automation.Sql.Database(Common.Properties.ConnectionString); db.ExecuteScalar("DELETE FROM Banner"); Bobs.Usr u = new Bobs.Usr(); u.Update(); Bobs.Banner b = new Bobs.Banner(); b.Update(); IdentityPropertyRules t = new IdentityPropertyRules(new UsrIdentity(u)); RequestRules rr = new RequestRules(); rr.Add(t); Assert.AreEqual(1, rr.GetBannersSatsfyingQueryConditionsInTimeslot(Timeslots.GetCurrentTimeslot()).Count); b.SetTargettingProperty(Bobs.Banner.TargettingProperty.Employment_4, true); b.Update(); Assert.AreEqual(1, rr.GetBannersSatsfyingQueryConditionsInTimeslot(Timeslots.GetCurrentTimeslot()).Count); }
public void TargettingBitInfoType_Usr_Test1() { Common.Automation.Sql.Database db = new Common.Automation.Sql.Database(Common.Properties.ConnectionString); db.ExecuteScalar("DELETE FROM Banner"); Bobs.Usr u = new Bobs.Usr() { IsMale = false, IsFemale = true }; u.Update(); UsrIdentity id = new UsrIdentity(u); Bobs.Banner b = new Bobs.Banner(); b.Update(); IdentityPropertyRules t = new IdentityPropertyRules(id); RequestRules rr = new RequestRules(); rr.Add(t); Assert.AreEqual(1, rr.GetBannersSatsfyingQueryConditionsInTimeslot(Timeslots.GetCurrentTimeslot()).Count); }
public void UsrFavoursParentMusicType_BannerTargetsChild_BannerIsServed() { Usr u = new Usr(); u.Name = Guid.NewGuid().ToString(); u.Update(); MusicType parentMusicType = new MusicType() { ParentK = 1 }; parentMusicType.Update(); MusicType childMusicType = new MusicType() { ParentK = parentMusicType.K }; childMusicType.Update(); UsrMusicTypeFavourite umtf = new UsrMusicTypeFavourite() { MusicTypeK = parentMusicType.K, UsrK = u.K }; umtf.Update(); Banner b = new Banner() { IsMusicTargetted = true }; b.Update(); b.SaveMusicTargetting(new List<int>() { childMusicType.K }); MusicTypesFavouredByIdentityRule rule = new MusicTypesFavouredByIdentityRule(new UsrIdentity(u)); RequestRules rr = new RequestRules(); rr.MusicTypes = rule; ReadOnlyCollection<BannerDataHolder> results = rr.GetBannersSatsfyingQueryConditionsInTimeslot(Timeslots.GetCurrentTimeslot()); Assert.IsTrue(ContainsBanner(b.K, results)); }
public void UsrFavoursOneMusicType_BannerTargetsAnother_BannerIsNotServed() { Usr u = new Usr(); u.Name = Guid.NewGuid().ToString(); u.Update(); MusicType musicTypeA = new MusicType() { ParentK = 1 }; musicTypeA.Update(); MusicType musicTypeB = new MusicType() { ParentK = 1 }; musicTypeB.Update(); UsrMusicTypeFavourite umtf = new UsrMusicTypeFavourite() { MusicTypeK = musicTypeA.K, UsrK = u.K }; umtf.Update(); Banner b = new Banner() { IsMusicTargetted = true }; b.Update(); BannerMusicType bmt = new BannerMusicType() { BannerK = b.K, MusicTypeK = musicTypeB.K }; bmt.Update(); MusicTypesFavouredByIdentityRule rule = new MusicTypesFavouredByIdentityRule(new UsrIdentity(u)); RequestRules rr = new RequestRules() { MusicTypes = rule }; ReadOnlyCollection<BannerDataHolder> results = rr.GetBannersSatsfyingQueryConditionsInTimeslot(Timeslots.GetCurrentTimeslot()); Assert.IsFalse(ContainsBanner(b.K, results)); }
public void TargettingBitInfoType_Demographics_SpendCds3() { Common.Automation.Sql.Database db = new Common.Automation.Sql.Database(Common.Properties.ConnectionString); db.ExecuteScalar("DELETE FROM Banner"); Bobs.Usr u = new Bobs.Usr(); u.Guid = Guid.NewGuid(); u.Update(); Bobs.Banner b = new Bobs.Banner(); b.SetTargettingProperty(Bobs.Banner.TargettingProperty.SpendMusicCd_MoreThanZero, true); b.Update(); Bobs.Demographics d = new Bobs.Demographics() { Guid = u.Guid, SpendMusicCd = 7 }; d.Update(); IdentityPropertyRules t = new IdentityPropertyRules(new UsrIdentity(u)); RequestRules rr = new RequestRules(); rr.Add(t); Assert.AreEqual(0, rr.GetBannersSatsfyingQueryConditionsInTimeslot(Timeslots.GetCurrentTimeslot()).Count); }
protected override List <MasterDetailRuleInfo> CreateRules(Frame frame) { return(RequestRules.Invoke(frame)); }