jeudi 8 octobre 2015

Verify and set list parameter in function of mock object

I have and interface IDatabaseInteraction:

public interface IDatabaseInteraction
{
    void FillAppSection(List<AppSectionId> appSectionIds);
}

The definition for AppSectionId is:

public class AppSectionId
{
    public string App;
    public string Section;
    public int Id;
}

I abstracted the database call into IDatabaseInteraction for the class under test. The list comes in (in this testcase 1 item in appSectionIds) and is updated in the FillAppSection method, the Id gets filled. I want to check the items App and Section values and secondly, I want to set the Id. How do I do that using moq?

Aucun commentaire:

Enregistrer un commentaire