using System;

using NHibernate;

using NUnit.Framework;

namespace NHibernate.Test.TypesTest
{
	/// <summary>
	/// Summary description for BinaryBlobTypeFixture.
	/// </summary>
	[TestFixture]
	public class BinaryBlobTypeFixture : TypeFixtureBase
	{
		protected override string TypeName
		{
			get { return "BinaryBlob"; }
		}

		[Test]
		public void ReadWrite() 
		{
			ISession s = OpenSession();
			BinaryBlobClass b = new BinaryBlobClass();
			b.BinaryBlob = System.Text.UnicodeEncoding.UTF8.GetBytes("foo/bar/baz");
			s.Save(b);
			s.Flush();
			s.Close();

			s = OpenSession();
			b = (BinaryBlobClass)s.Load( typeof(BinaryBlobClass), b.Id );
			ObjectAssert.AreEqual( System.Text.UnicodeEncoding.UTF8.GetBytes("foo/bar/baz") , b.BinaryBlob );
			s.Delete( b );
			s.Flush();
			s.Close();
		}
	}
}

using System;

using NHibernate;

using NUnit.Framework;

namespace NHibernate.Test.TypesTest
{
	/// <summary>
	/// Summary description for BinaryBlobTypeFixture.
	/// </summary>
	[TestFixture]
	public class BinaryBlobTypeFixture : TypeFixtureBase
	{
		protected override string TypeName
		{
			get { return "BinaryBlob"; }
		}

		[Test]
		public void ReadWrite() 
		{
			ISession s = OpenSession();
			BinaryBlobClass b = new BinaryBlobClass();
			b.BinaryBlob = System.Text.UnicodeEncoding.UTF8.GetBytes("foo/bar/baz");
			s.Save(b);
			s.Flush();
			s.Close();

			s = OpenSession();
			b = (BinaryBlobClass)s.Load( typeof(BinaryBlobClass), b.Id );
			ObjectAssert.AreEqual( System.Text.UnicodeEncoding.UTF8.GetBytes("foo/bar/baz") , b.BinaryBlob );
			s.Delete( b );
			s.Flush();
			s.Close();
		}

		[Test]
		public void ReadWriteLargeBlob()
		{
			ISession s = OpenSession();
			BinaryBlobClass b = new BinaryBlobClass();
			b.BinaryBlob = System.Text.UnicodeEncoding.UTF8.GetBytes(new string('T', 10000));
			s.Save(b);
			s.Flush();
			s.Close();

			s = OpenSession();
			b = (BinaryBlobClass)s.Load( typeof(BinaryBlobClass), b.Id );
			ObjectAssert.AreEqual( System.Text.UnicodeEncoding.UTF8.GetBytes(new string('T', 10000)) , b.BinaryBlob );
			s.Delete( b );
			s.Flush();
			s.Close();
		}
	}
}

Test for large binary blobs (more than 8000 bytes), just to be sure it works.
Test for large binary blobs (more than 8000 bytes), just to be sure it works.

SVN: 488784591515bd4cdaa016be4ec9b172dc4e7caf@2185
