Пример #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Mock{T}"/> class.
 /// </summary>
 internal Mock(ActorExecutionContext.Mock context, T value)
     : base(value)
 {
     this.Context       = context;
     this.RegisterActor = context.CreateActor(typeof(SharedRegisterActor <T>));
     context.SendEvent(this.RegisterActor, SharedRegisterEvent.SetEvent(value));
 }
Пример #2
0
            /// <summary>
            /// Initializes a new instance of the <see cref="Mock"/> class.
            /// </summary>
            internal Mock(int value, ActorExecutionContext.Mock context)
                : base(value)
            {
                this.Context      = context;
                this.CounterActor = context.CreateActor(typeof(SharedCounterActor));
                var op = context.Runtime.GetExecutingOperation <ActorOperation>();

                context.SendEvent(this.CounterActor, SharedCounterEvent.SetEvent(op.Actor.Id, value));
                op.Actor.ReceiveEventAsync(typeof(SharedCounterResponseEvent)).Wait();
            }
Пример #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Mock{TKey, TValue}"/> class.
 /// </summary>
 internal Mock(ActorExecutionContext.Mock context, IEqualityComparer <TKey> comparer)
     : base(null)
 {
     this.Context = context;
     if (comparer != null)
     {
         this.DictionaryActor = context.CreateActor(
             typeof(SharedDictionaryActor <TKey, TValue>),
             SharedDictionaryEvent.InitializeEvent(comparer));
     }
     else
     {
         this.DictionaryActor = context.CreateActor(typeof(SharedDictionaryActor <TKey, TValue>));
     }
 }