示例#1
0
		public void NickNameCachingIsWorking()
		{
			SetupCacheForTesting();
			Usr usr1 = new Usr(1);
			UnitTestUtilities.Sql.SqlTrace trace = new UnitTestUtilities.Sql.SqlTrace(Common.Properties.ConnectionString);
			trace.Start();
			Usr usrGotWithoutCachedNickname = Usr.GetFromNickName(usr1.NickName);
			trace.Stop();
			Assert.AreNotEqual(0, trace.TotalReads);
			trace.ClearData();
			trace.Start();
			Usr usrGotWithCachedNickname = Usr.GetFromNickName(usr1.NickName);
			trace.Stop();
			Assert.AreEqual(0, trace.TotalReads);

		}
示例#2
0
		public void BobsCachingIsWorking()
		{
			SetupCacheForTesting();
			
			UnitTestUtilities.Sql.SqlTrace trace = new UnitTestUtilities.Sql.SqlTrace(Common.Properties.ConnectionString);
			trace.Start();
			Usr usr = new Usr();
			usr.Update();
			trace.Stop();
			Assert.AreNotEqual(0, trace.TotalReads, "First read was zero");
			trace.ClearData();
			trace.Start();
			Usr selectedUsr = new Usr(usr.K);
			trace.Stop();
			Assert.AreNotEqual(0, trace.TotalReads, "Second read was zero");

			trace.ClearData();
			trace.Start();
			Usr cachedUsr = new Usr(usr.K);
			trace.Stop();
			Assert.AreEqual(0, trace.TotalReads, "Third read was not zero");
		}