Exemple #1
0
        /// <summary>
        /// Creates an instance of <see cref="ActorHost" /> for unit testing an actor instance.
        /// </summary>
        /// <param name="actorType">The actor type.</param>
        /// <param name="options">The <see cref="ActorTestOptions" /> for configuring the host.</param>
        /// <returns>An <see cref="ActorHost" /> instance.</returns>
        public static ActorHost CreateForTest(Type actorType, ActorTestOptions options = null)
        {
            if (actorType == null)
            {
                throw new ArgumentNullException(nameof(actorType));
            }

            options ??= new ActorTestOptions();

            return(new ActorHost(
                       ActorTypeInformation.Get(actorType),
                       options.ActorId,
                       options.JsonSerializerOptions,
                       options.LoggerFactory,
                       options.ProxyFactory,
                       options.TimerManager));
        }
Exemple #2
0
 /// <summary>
 /// Creates an instance of <see cref="ActorHost" /> for unit testing an actor instance.
 /// </summary>
 /// <param name="actorType">The actor type.</param>
 /// <param name="options">The <see cref="ActorTestOptions" /> for configuring the host.</param>
 /// <returns>An <see cref="ActorHost" /> instance.</returns>
 public static ActorHost CreateForTest(Type actorType, ActorTestOptions options = null)
 {
     return(CreateForTest(actorType, actorTypeName: null, options));
 }
Exemple #3
0
 /// <summary>
 /// Creates an instance of <see cref="ActorHost" /> for unit testing an actor instance.
 /// </summary>
 /// <param name="options">The <see cref="ActorTestOptions" /> for configuring the host.</param>
 /// <typeparam name="TActor">The actor type.</typeparam>
 /// <returns>An <see cref="ActorHost" /> instance.</returns>
 public static ActorHost CreateForTest <TActor>(ActorTestOptions options = null)
     where TActor : Actor
 {
     return(CreateForTest(typeof(TActor), options));
 }
Exemple #4
0
 /// <summary>
 /// Creates an instance of <see cref="ActorHost" /> for unit testing an actor instance.
 /// </summary>
 /// <param name="actorTypeName">The name of the actor type represented by the actor.</param>
 /// <param name="options">The <see cref="ActorTestOptions" /> for configuring the host.</param>
 /// <typeparam name="TActor">The actor type.</typeparam>
 /// <returns>An <see cref="ActorHost" /> instance.</returns>
 public static ActorHost CreateForTest <TActor>(string actorTypeName, ActorTestOptions options = null)
     where TActor : Actor
 {
     return(CreateForTest(typeof(TActor), actorTypeName, options));
 }