jeudi 29 octobre 2015

Test a private method with PrivateObject

I have a class,

public class VoiceElementsLine : ILine
{
    private SipChannel _incomingSipChannel;


    private void AnswerSipChannel()
    {
        _incomingSipChannel.Answer();
    }

What I want to test is to test the private method AnswerSipChannel be executed. I want to use PrivateObject.

How?

My code:

   [Fact]
    public void AnswerSipChannel_Should_Execute()
    {
        var privateObject = new PrivateObject(typeof (VoiceElementsLine));
        var mockSipChannel = new Mock<SipChannel>();

    }

Aucun commentaire:

Enregistrer un commentaire