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_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 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);
		}