public void VerifyProxyForClassWithInterface()
		{
			var factory = new StaticProxyFactory();
			factory.PostInstantiate(
				typeof(PublicInterfaceTestClass).FullName,
				typeof(PublicInterfaceTestClass),
				new HashSet<System.Type> {typeof(INHibernateProxy)},
				null, null, null);

#if NETFX
			VerifyGeneratedAssembly(
				() =>
				{
#endif
					var proxy = factory.GetProxy(1, null);
					Assert.That(proxy, Is.Not.Null);
					Assert.That(proxy, Is.InstanceOf<IPublic>());
					Assert.That(proxy, Is.InstanceOf<PublicInterfaceTestClass>());

					// Check interface and implicit implementations do both call the delegated state
					var state = new PublicInterfaceTestClass { Id = 5, Name = "State" };
					proxy.HibernateLazyInitializer.SetImplementation(state);
					var pub = (IPublic) proxy;
					var ent = (PublicInterfaceTestClass) proxy;
					Assert.That(pub.Id, Is.EqualTo(5), "IPublic.Id");
					Assert.That(ent.Id, Is.EqualTo(5), "entity.Id");
					Assert.That(pub.Name, Is.EqualTo("State"), "IPublic.Name");
					Assert.That(ent.Name, Is.EqualTo("State"), "entity.Name");
					ent.Id = 10;
					pub.Name = "Test";
					Assert.That(pub.Id, Is.EqualTo(10), "IPublic.Id");
					Assert.That(state.Id, Is.EqualTo(10), "state.Id");
					Assert.That(ent.Name, Is.EqualTo("Test"), "entity.Name");
					Assert.That(state.Name, Is.EqualTo("Test"), "state.Name");
#if NETFX
				});
#endif
		}
		public void VerifyProxyForClassWithGenericNonVirtualMethod()
		{
			var factory = new StaticProxyFactory();
			factory.PostInstantiate(
				typeof(ClassWithGenericNonVirtualMethod).FullName,
				typeof(ClassWithGenericNonVirtualMethod),
				new HashSet<System.Type> { typeof(INHibernateProxy) },
				null, null, null, true);

#if NETFX
			VerifyGeneratedAssembly(
				() =>
				{
#endif
					var proxy = factory.GetProxy(1, null);
					Assert.That(proxy, Is.Not.Null);
					Assert.That(proxy, Is.InstanceOf<ClassWithGenericNonVirtualMethod>());

					Assert.That(factory.GetFieldInterceptionProxy(), Is.InstanceOf<ClassWithGenericNonVirtualMethod>());

#if NETFX
				});
#endif
		}
		public void VerifyProxyForClassWithExplicitInterfaceWithSameMembers()
		{
			var factory = new StaticProxyFactory();
			factory.PostInstantiate(
				typeof(PublicExplicitInterfaceWithSameMembersTestClass).FullName,
				typeof(PublicExplicitInterfaceWithSameMembersTestClass),
				new HashSet<System.Type> {typeof(INHibernateProxy)},
				null, null, null, true);
#if NETFX
			VerifyGeneratedAssembly(
				() =>
				{
#endif
					var proxy = factory.GetProxy(1, null);
					Assert.That(proxy, Is.Not.Null);
					Assert.That(proxy, Is.InstanceOf<IPublic>());
					Assert.That(proxy, Is.InstanceOf<PublicExplicitInterfaceWithSameMembersTestClass>());
					var proxyType = proxy.GetType();
					var proxyMap = proxyType.GetInterfaceMap(typeof(IPublic));
					Assert.That(
						proxyMap.TargetMethods,
						Has.None.EqualTo(proxyType.GetProperty(nameof(PublicExplicitInterfaceWithSameMembersTestClass.Name)).GetMethod),
						"class Name getter does implement IPublic");
					Assert.That(
						proxyMap.TargetMethods,
						Has.None.EqualTo(proxyType.GetProperty(nameof(PublicExplicitInterfaceWithSameMembersTestClass.Name)).SetMethod),
						"class Name setter does implement IPublic");
					Assert.That(
						proxyMap.TargetMethods,
						Has.None.EqualTo(proxyType.GetProperty(nameof(PublicExplicitInterfaceWithSameMembersTestClass.Id)).GetMethod),
						"class Id setter does implement IPublic");
					Assert.That(
						proxyMap.TargetMethods,
						Has.None.EqualTo(proxyType.GetProperty(nameof(PublicExplicitInterfaceWithSameMembersTestClass.Id)).SetMethod),
						"class Id setter does implement IPublic");

					// Check interface and implicit implementations do both call the delegated state
					var state = new PublicExplicitInterfaceWithSameMembersTestClass();
					IPublic pubState = state;
					state.Id = 5;
					state.Name = "State";
					pubState.Id = 10;
					pubState.Name = "State2";
					proxy.HibernateLazyInitializer.SetImplementation(state);
					var entity = (PublicExplicitInterfaceWithSameMembersTestClass) proxy;
					IPublic pubEntity = entity;
					Assert.That(entity.Id, Is.EqualTo(5), "Id member");
					Assert.That(entity.Name, Is.EqualTo("State"), "Name member");
					Assert.That(pubEntity.Id, Is.EqualTo(10), "Id from interface");
					Assert.That(pubEntity.Name, Is.EqualTo("State2"), "Name from interface");

					entity.Id = 15;
					entity.Name = "Test";
					pubEntity.Id = 20;
					pubEntity.Name = "Test2";
					Assert.That(entity.Id, Is.EqualTo(15), "entity.Id");
					Assert.That(state.Id, Is.EqualTo(15), "state.Id");
					Assert.That(entity.Name, Is.EqualTo("Test"), "entity.Name");
					Assert.That(state.Name, Is.EqualTo("Test"), "state.Name");
					Assert.That(pubEntity.Id, Is.EqualTo(20), "pubEntity.Id");
					Assert.That(pubState.Id, Is.EqualTo(20), "pubState.Id");
					Assert.That(pubEntity.Name, Is.EqualTo("Test2"), "pubEntity.Name");
					Assert.That(pubState.Name, Is.EqualTo("Test2"), "pubState.Name");
#if NETFX
				});
#endif
		}