vendredi 28 août 2015

Make unit test pass only when callback is called

I'm trying to unit test a bit of code to make sure that a callback is invoked, but it seems that even without an "Assert"-call in the method it will pass. Consider the code example below:

public void Show_ShowSomeAdFormat_CallbackShouldBeInvoked()
{
    AdManager adManager = new AdManager();

    adManager.Show<VideoTestAdFormat>((response) =>
    {
        //Assert.Pass(); <--- With or without this, the test will pass. 
        //I need it to only pass if it reaches this. How is it done?
    });
}

If you read the comments I think you will understand what I am after.

Thank you!

Aucun commentaire:

Enregistrer un commentaire