public void IsUniqueTimeoutExpiredBug()
		{
			ActiveRecordStarter.Initialize(GetConfigSource(), typeof(Blog2), typeof(Blog5));
			Recreate();

			for (int i = 0; i < 5; i++)
			{
				Blog5 blog = new Blog5();
				blog.Name = "A cool blog";
				blog.Create();
			}

			Blog5 theBlog = new Blog5();
			theBlog.Name = "A cool blog";
			theBlog.Create();

			Blog5 anotherBlog = new Blog5();
			anotherBlog.Name = "A cool blog";
			anotherBlog.Create();
				
			anotherBlog.Name = "A very cool blog";
			anotherBlog.Update();

			Assert.IsFalse(Blog2.Find(theBlog.Id).IsValid());

			Blog2 weblog = new Blog2();
			weblog.Name = theBlog.Name;

			Assert.IsFalse(weblog.IsValid());
			
			weblog.Create();
		}
		public void ValidateIsUniqueWithinTransactionScope()
		{
			ActiveRecordStarter.Initialize( GetConfigSource(), typeof(Blog2) );
			Recreate();
			
			// The IsUniqueValidator was created a new SessionScope and causing an
			// error when used inside TransactionScope
			
			using (TransactionScope scope = new TransactionScope())
			{
				Blog2 blog = new Blog2();
				blog.Name = "A cool blog";
				blog.Create();
					
				blog = new Blog2();
				blog.Name = "Another cool blog";
				blog.Create();
				
				scope.VoteCommit();
			}
		}
		public void IsUniqueWithInvalidData()
		{
			ActiveRecordStarter.Initialize( GetConfigSource(), typeof(Blog2), typeof(Blog2B) );
			Recreate();

			Blog2B.DeleteAll();

			Blog2B blog = new Blog2B();
			blog.Name = "hammett";
			blog.Create();
			
			blog = new Blog2B();
			blog.Name = "hammett";
			blog.Create();
			
			Blog2 blog2 = new Blog2();
			blog2.Name = blog.Name;
			
			Assert.IsFalse(blog2.IsValid());
		}
		public void IsUniqueWithSessionScope()
		{
			ActiveRecordStarter.Initialize(GetConfigSource(), typeof (Blog2));
			Recreate();

			Blog2.DeleteAll();

			Blog2 blog = new Blog2();
			blog.Name = "hammett";
			blog.Create();

			using (new SessionScope())
			{
				Blog2 fromDb = Blog2.Find(blog.Id);
				fromDb.Name = "foo";
				fromDb.Save();
			}
		}
		public void IsUnique()
		{
			ActiveRecordStarter.Initialize( GetConfigSource(), typeof(Blog2) );
			Recreate();

			Blog2.DeleteAll();

			Blog2 blog = new Blog2();
			blog.Name = "hammett";
			blog.Create();

			blog = new Blog2();
			blog.Name = "hammett";
			
			String[] messages = blog.ValidationErrorMessages;
			Assert.IsTrue(messages.Length == 1);
			Assert.AreEqual("Name is currently in use. Please pick up a new Name.", messages[0]);

			blog.Create();
		}