Exemplo n.º 1
0
 /// <summary>Gets all the service names for the current ICreateTestUserRequest.</summary>
 public static IEnumerable <string> GetServiceNames(this ICreateTestUserRequest request)
 {
     return(request.GetType()
            .GetFields(BindingFlags.Public | BindingFlags.Static)
            .Where(f => f.GetCustomAttribute <ServiceNameAttribute>() != null)
            .Select(f => (string)f.GetValue(null)));
 }
Exemplo n.º 2
0
        /// <summary>Creates a test agent user with the specified services.</summary>
        /// <param name="request">The requested service names.</param>
        public UserResultBase CreateUser(ICreateTestUserRequest request)
        {
            var method = GetType().GetMethods().Where(t => {
                return(nameof(CreateUser).Equals(t.Name) && t.GetParameters().First().ParameterType == request.GetType());
            }).First();

            return(method.Invoke(this, new object[] { request }) as UserResultBase);
        }