public void TargettingBitInfoType_Demographics_Test2() { 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.Employment_4, true); b.Update(); Bobs.Demographics d = new Bobs.Demographics() { Guid = u.Guid, Employment = 4 }; d.Update(); IdentityPropertyRules t = new IdentityPropertyRules(new UsrIdentity(u)); RequestRules rr = new RequestRules(); rr.Add(t); Assert.AreEqual(0, rr.GetBannersSatsfyingQueryConditionsInTimeslot(Timeslots.GetCurrentTimeslot()).Count); }
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_Usr_Test2() { 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 = true, IsFemale = false }; u.Update(); UsrIdentity id = new UsrIdentity(u); Bobs.Banner b = new Bobs.Banner(); b.SetTargettingProperty(Banner.TargettingProperty.Gender_Unknown, true); b.SetTargettingProperty(Banner.TargettingProperty.Gender_Female, true); b.SetTargettingProperty(Banner.TargettingProperty.Gender_Male, true); b.Update(); IdentityPropertyRules t = new IdentityPropertyRules(id); Assert.AreEqual(0, new BannerSet(new Query(t.Q)).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); }
internal int GetCurrentQueueSize() { Common.Automation.Sql.Database db = new Common.Automation.Sql.Database(Common.Properties.ConnectionString); return (int) db.ExecuteScalar("SELECT COUNT(*) FROM QRTZ_JOB_DETAILS WHERE JOB_GROUP = 'immediate'"); }
public void TargettingBitInfoType_Demographics_SpendCds1() { 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.SpendMusicCd_MoreThanZero, true); b.Update(); Assert.AreEqual(1, rr.GetBannersSatsfyingQueryConditionsInTimeslot(Timeslots.GetCurrentTimeslot()).Count); }
//[Test] public void BannerQuerySetInfosInDescendingPriorityOrderWorksAsIEnumerable() { Common.Automation.Sql.Database db = new Common.Automation.Sql.Database(Common.Properties.ConnectionString); db.ExecuteScalar("DELETE FROM Banner"); 10.Times(i => AddValidBanner(1, i)); Rules.RequestRules rr = new Bobs.BannerServer.Rules.RequestRules(); int expectedPriority = 9; bool firstOfThisPriority = true; // due to Required then Desired Sets, we expect each banner to turn up twice foreach (BannerQuerySetInfo bqsi in rr.BannerQuerySetInfosInDescendingPriorityOrder(Timeslots.GetCurrentTimeslot())) { Assert.AreEqual(1, bqsi.Banners.Count); Assert.AreEqual(expectedPriority, bqsi.Banners[0].Priority); if (firstOfThisPriority) { firstOfThisPriority = false; } else { firstOfThisPriority = true; expectedPriority--; } } }