using System;
using System.Reflection;
namespace Homelidays.Web.SessionService.Tests
{
///
/// A helper class that eases reflection operations.
/// voici Les méthodes à implémenter au fur et à mesure des besoins:
/// - internal static object CallNonPublicStaticMethod(string className, string methodName)
/// - internal static object InstanciateNonPublicClass(string className)
///
internal static class ReflectionUtility
{
///
/// Call a non public property of an object.
///
/// Object whose method to call is private.
/// Name of the property to call.
/// The object returned by the private method to call.
internal static object GetNonPubicProperty(object instance, string propertyName)
{
Type type = instance.GetType();
var return_object = type.InvokeMember(
propertyName,
BindingFlags.Instance | BindingFlags.GetProperty,
null,
instance,
null);
return return_object;
}
}
}