starting fixing proxy equality issue (false == proxy.Equals(proxy))

This commit is contained in:
eeichinger
2009-03-08 16:16:08 +00:00
parent c161b030ca
commit 0432bc07fd
4 changed files with 94 additions and 43 deletions

View File

@@ -263,6 +263,24 @@ namespace Spring.Aop.Framework.DynamicProxy
string Company { get; set; }
}
public class TestCustomer : ITestCustomer
{
public long Id
{
get; set;
}
public string Name
{
get; set;
}
public string Company
{
get; set;
}
}
#endregion
[Test(Description = "http://jira.springframework.org/browse/SPRNET-1174")]
@@ -290,6 +308,22 @@ namespace Spring.Aop.Framework.DynamicProxy
mocks.VerifyAll();
}
[Test]
public void Equality()
{
TestCustomer customer = new TestCustomer();
AdvisedSupport advised = new AdvisedSupport();
advised.Target = customer;
advised.Interfaces = new Type[] { typeof(ITestCustomer) };
ITestCustomer to = CreateProxy(advised) as ITestCustomer;
Assert.IsNotNull(to);
Assert.IsTrue( to.Equals(to), "identity must be equal" );
Assert.AreEqual(to, to);
Assert.AreEqual(to, ((IAdvised)to).TargetSource.GetTarget());
}
[Test]
[ExpectedException(typeof(NotSupportedException)
, ExpectedMessage = "Target 'target' is null.")]

View File

@@ -44,7 +44,7 @@
<WarningLevel>3</WarningLevel>
<DebugType>full</DebugType>
<ErrorReport>prompt</ErrorReport>
<UseVSHostingProcess>true</UseVSHostingProcess>
<UseVSHostingProcess>false</UseVSHostingProcess>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<OutputPath>..\..\..\build\VS.Net.2008\Spring.Aop.Tests\Release\</OutputPath>