dimanche 4 octobre 2015

unit testing on public void method which updates private member

I have the public void method below:

public void Reset()
{
   // Get updates
   // update logic for each value in _dict
}

while _dict is a private member of the class:

private readonly dictionary<string, string> _dict;   

How can I perform unit test on the update logic of Reset() method? How can I verify the values in _dict are correct after reset? I do not want to set up public getter for _dict to expose it.

I am using xunit and C#.

Aucun commentaire:

Enregistrer un commentaire