I\'m testing a class that is part of a hierarchy. I\'ve been setting up my test classes with the object under test, and a PrivateObject to allow access to that
// create an instance of class SearchPlanogramsBuilder:
SearchPlanogramsBuilder searchPlanogramBuilder = new SearchPlanogramsBuilder();
// executing the method BuildSearchParameters(return type is void) with input searchPlanoGramsFilters:
searchPlanogramBuilder.BuildSearchParameters(searchPlanoGramsFilters);
// create privateobject and pass instance created for the class:
PrivateObject helperobject1 = new PrivateObject(searchPlanogramBuilder);
// type cast exactly as parameter(which is private variable) in the method:
Collection parameter = (Collection)helperobject1.GetFieldOrProperty("parameters");