I'm trying to test a private class in an assembly and so have tried to create a private accessor to the assembly. However when I compile the unit test assembly I get an error "Signature of the body and declaration in a method implementation do not match. Type: 'Indexer'. Assembly: 'ClassLibrary_Accessor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. TestProject".
The definition of the Indexer type is
public class Class1
{
private class Indexer : IComparable<Indexer>
{
#region IComparable<Indexer> Members
int IComparable<Indexer>.CompareTo(Indexer other)
{
return 0;
}
#endregion
}
}
The problem seems to be due to the explicit implementation of the IComparable interface as if I swap to an implicit implementation the error goes away. Is this a bug in the unit test framework?
Is there a work around? The class that the error is raised for is not the one I am interested in testing, however there are a reasonable number of similarly implemented class in the assembly. Can I restrict the accessor to only wrap the class that I am interested in?
Many thanks