示例#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));
        }
示例#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));
 }
示例#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));
 }
示例#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));
 }