You should use Test-Specific subclass if you want to test protected methods explicitely.
The simpliest example is below:
internal class CSGetBuyerAbuseReportsRequestTanslatorTSS : CSGetBuyerAbuseReportsRequestTanslator
{
public CSGetBuyerAbuseReportsRequestType ExposeBusinessToService(IEntityTranslatorService service, BuyerAbuseRequest value)
{
return BusinessToServic(service, value);
}
}
And in you tests you will be able to call protected methods through the public ones in a Test-Specific subclass.
[TestFixture]
public class SubclassTests
{
[Test]
public void Test()
{
var sut = new CSGetBuyerAbuseReportsRequestTanslatorTSS();
//arrange your system under test here
//...
var result = sut.ExposeBusinessToService(service, value);
Assert.AreEqual(expectedResult, result);
}
}
The other option is to use reflection:
[TestFixture]
public class ReflectionTests
{
[Test]
public void Test()
{
var sut = new CSGetBuyerAbuseReportsRequestTanslator();
//arrange your system under test here
//...
var result = sut.GetType()
.GetMethod("BusinessToService", BindingFlags.NonPublic)
.Invoke(result, new [] {service, value});
Assert.AreEqual(expectedResult, result);
}
}
However you should consider splitting your class if you can't test through its public interfaces.
Your class is internal in the example, if you have tests in a separate assembly you should use InternalsVisibleToAttribute
to be able to access it from the tests assembly.