Is there a way to write unit test that prove class has only public members?
I've done some research about the problem and tried some code but I don't have a solution so far. I am stuck at the point where i need to check are there any private property.
//In the unit test
var viewModels = AppDomain.CurrentDomain.GetAssemblies()
.SelectMany(a => a.GetTypes())
.Where(a => a.Namespace != null &&
a.Namespace.StartsWith("Test.Solution"))
.Where(t => t.Name.EndsWith("View"))
.ToList();
//ViewModels
public class PersonView {
public string DurationMinutes; // don't take this into consideration
public string Name { get; set; }
public string LastName { get; set; }
private string Number{ get; set; }
// take into consideration only properies with getter and setter
}