public static void GetGetMethod_GetSetMethod(string name, bool publicGet, bool nonPublicGet, bool publicSet, bool nonPublicSet)
{
PropertyInfo pi = typeof(PropertyInfoMembers).GetTypeInfo().GetProperty(name, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
if (publicGet)
{
Assert.Equal("get_" + name, pi.GetGetMethod().Name);
Assert.Equal("get_" + name, pi.GetGetMethod(true).Name);
Assert.Equal("get_" + name, pi.GetGetMethod(false).Name);
}
else
{
Assert.Null(pi.GetGetMethod());
}
if (nonPublicGet)
{
Assert.Equal("get_" + name, pi.GetGetMethod(true).Name);
}
else
{
Assert.Null(pi.GetGetMethod());
Assert.Null(pi.GetGetMethod(false));
}
if (publicSet)
{
Assert.Equal("set_" + name, pi.GetSetMethod().Name);
Assert.Equal("set_" + name, pi.GetSetMethod(true).Name);
Assert.Equal("set_" + name, pi.GetSetMethod(false).Name);
}
else
{
Assert.Null(pi.GetSetMethod());
}
if (nonPublicSet)
{
Assert.Equal("set_" + name, pi.GetSetMethod(true).Name);
}
else
{
Assert.Null(pi.GetSetMethod());
Assert.Null(pi.GetSetMethod(false));
}
}