예제 #1
0
		public void should_be_able_to_call_generic_methods_on_a_proxy()
		{
			var addressId = Guid.Empty;
			using (ISession session = sessions.OpenSession())
			{
				using (ITransaction tx = session.BeginTransaction())
				{
					
					var address = new Address();

					session.SaveOrUpdate(address);
					tx.Commit();
					addressId = address.Id;
				}
			}

			using (ISession session = sessions.OpenSession())
			{
				using (session.BeginTransaction())
				{
					var address = session.Load<Address>(addressId);

					Assert.That(address, Is.AssignableTo<INHibernateProxy>());

					// call to generic method on a proxy will fail on .Net 4.0
					var res = address.GenericMethod<int>(42);
					Assert.That(res, Is.EqualTo(42));
				}
			}
		}