Exemplo n.º 1
0
        void FirstCommandConsumer(IConsumeContext <FirstCommand> context, FirstCommand message)
        {
            ThreadUtil.Sleep(10.Milliseconds());

            var response = new FirstResponse(message.CorrelationId);

            context.Respond(response);
        }
Exemplo n.º 2
0
        public static void UseCommand()
        {
            var firstCommand  = new FirstCommand(1);
            var secondCommand = new SecondCommand(2);

            firstCommand.Execute();
            secondCommand.Execute();
        }
Exemplo n.º 3
0
        protected override void OnModelChanged()
        {
            NextCommand.RaiseCanExecuteChanged();
            PreviousCommand.RaiseCanExecuteChanged();
            FirstCommand.RaiseCanExecuteChanged();
            LastCommand.RaiseCanExecuteChanged();

            RaisePropertyChanged(nameof(TotalPages));
        }
        protected override async Task When()
        {
            var someCommand = new FirstCommand();
            await Bus.Send(someCommand);
            await Timeout.WaitUntil(() => MethodCallCounter.AllReceivedMessages.Count() >= _numExpectedMessages);

            _dispatchContexts = TestInterceptor.DispatchContexts.ToArray();
            _nimbusMessages = TestInterceptor.NimbusMessages.ToArray();
        }
        protected override async Task When()
        {
            var someCommand = new FirstCommand();
            await Bus.Send(someCommand);
            await TimeSpan.FromSeconds(10).WaitUntil(() => MethodCallCounter.AllReceivedMessages.Count() >= _numExpectedMessages);

            _dispatchContexts = TestInterceptor.DispatchContexts.ToArray();
            _brokeredMessages = TestInterceptor.BrokeredMessages.ToArray();
        }
Exemplo n.º 6
0
        protected override async Task When()
        {
            var someCommand = new FirstCommand();
            await Bus.Send(someCommand);

            await Timeout.WaitUntil(() => MethodCallCounter.AllReceivedMessages.Count() >= _numExpectedMessages);

            _dispatchContexts = TestInterceptor.DispatchContexts.ToArray();
            _nimbusMessages   = TestInterceptor.NimbusMessages.ToArray();
        }
Exemplo n.º 7
0
        public void RunCommand()
        {
            var result = false;

            var sut = new FirstCommand(() => result = true);

            sut.Run();

            Assert.True(result);
        }
        protected override async Task When()
        {
            var someCommand = new FirstCommand();
            await Bus.Send(someCommand);

            await TimeSpan.FromSeconds(10).WaitUntil(() => MethodCallCounter.AllReceivedMessages.Count() >= _numExpectedMessages);

            _dispatchContexts = TestInterceptor.DispatchContexts.ToArray();
            _brokeredMessages = TestInterceptor.BrokeredMessages.ToArray();
        }
        public void Execute()
        {
            var message = new FirstCommand {
                MessageValue = Guid.NewGuid().ToString()
            };

            log.Info("Send Message " + message.MessageValue);

            endpoint.Send(message)
            .GetAwaiter().GetResult();
        }
Exemplo n.º 10
0
        private static Action <FirstCommand> FirstCommandConsumer(FirstCommand message)
        {
            return(command =>
            {
                ThreadUtil.Sleep(10.Milliseconds());

                var response = new FirstResponse(command.CorrelationId);

                CurrentMessage.Respond(response);
            });
        }
Exemplo n.º 11
0
        Action <FirstCommand> FirstCommandConsumer(FirstCommand message)
        {
            return(command =>
            {
                ThreadUtil.Sleep(10.Milliseconds());

                var response = new FirstResponse(command.CorrelationId);

                LocalBus.Context().Respond(response);
            });
        }
                public long SendFirstCommandRequest(EntityId entityId, global::Improbable.Gdk.Tests.BlittableTypes.FirstCommandRequest payload,
                                                    Action <FirstCommand.ReceivedResponse> callback, uint?timeoutMillis = null, bool allowShortCircuiting = false)
                {
                    if (!IsValid())
                    {
                        return(-1);
                    }

                    var ecsCommandRequestSender = entityManager.GetComponentData <CommandSenders.FirstCommand>(entity);
                    var request = FirstCommand.CreateRequest(entityId, payload, timeoutMillis, allowShortCircuiting, callback);

                    ecsCommandRequestSender.RequestsToSend.Add(request);
                    return(request.RequestId);
                }
                public long SendFirstCommandRequest(EntityId entityId, global::Improbable.Gdk.Tests.NonblittableTypes.FirstCommandRequest payload,
                                                    uint?timeoutMillis = null, bool allowShortCircuiting = false, object context = null)
                {
                    if (!VerifyNotDisposed())
                    {
                        return(-1);
                    }

                    var ecsCommandRequestSender = entityManager.GetComponentData <CommandSenders.FirstCommand>(entity);
                    var request = FirstCommand.CreateRequest(entityId, payload, timeoutMillis, allowShortCircuiting, context);

                    ecsCommandRequestSender.RequestsToSend.Add(request);
                    return(request.RequestId);
                }
Exemplo n.º 14
0
 private void Model_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
 {
     if (e.PropertyName == nameof(Model.MaximumRows) ||
         e.PropertyName == nameof(Model.StartRowIndex) ||
         e.PropertyName == nameof(Model.Count))
     {
         OnPropertyChanged(nameof(CurrentPage));
         OnPropertyChanged(nameof(CountOfPages));
         OnPropertyChanged(nameof(StringCountOfPages));
         FirstCommand.RiseCanExecute();
         PreviousCommand.RiseCanExecute();
         NextCommand.RiseCanExecute();
         LastCommand.RiseCanExecute();
     }
 }
Exemplo n.º 15
0
        static void Main(string[] args)
        {
            SetupContainer(IoC.Container);
            Console.WriteLine("hello world");
            FirstCommand command = new FirstCommand()
            {
                FirstRefenceProp = new FirstReference()
                {
                    ReferenceIdentifier = "First"
                }
            };
            IProcessCommands <FirstCommand> commandProcessor = IoC.Container.Resolve <IProcessCommands <FirstCommand> >();

            commandProcessor.Process(command);
            Console.ReadKey();
        }
 public void SendResponse(global::Improbable.Gdk.Tests.BlittableTypes.FirstCommandResponse payload)
 {
     entityManager.GetComponentData <CommandResponders.FirstCommand>(entity).ResponsesToSend
     .Add(FirstCommand.CreateResponse(Request, payload));
 }
Exemplo n.º 17
0
 private void FirstClick(object sender, EventArgs e)
 {
     FirstCommand?.Execute(null);
 }
Exemplo n.º 18
0
 public void Handle(FirstCommand command)
 {
     _eventAggregator.Publish(new CommandExecuted <FirstCommand>());
 }
Exemplo n.º 19
0
                public void SendFirstCommandRequest(EntityId entityId, global::Generated.Improbable.Gdk.Tests.NonblittableTypes.FirstCommandRequest request)
                {
                    var ecsCommandRequestSender = entityManager.GetComponentData <CommandSenders.FirstCommand>(entity);

                    ecsCommandRequestSender.RequestsToSend.Add(FirstCommand.CreateRequest(entityId, request));
                }
 protected override async Task When()
 {
     var someCommand = new FirstCommand();
     await Bus.Send(someCommand);
     await TimeSpan.FromSeconds(10).WaitUntil(() => MethodCallCounter.AllReceivedMessages.Any());
 }
Exemplo n.º 21
0
        public CommandCompleted Handle(FirstCommand command)
        {
            _firstCommand = command;

            return(new CommandCompleted());
        }
Exemplo n.º 22
0
 public CommandCompleted Handle(FirstCommand command)
 {
     return(new CommandFailed());
 }
Exemplo n.º 23
0
 public CommandCompleted Handle(FirstCommand command)
 {
     return(new CommandSucceeded());
 }
 public void SendResponseFailure(string message)
 {
     entityManager.GetComponentData <CommandResponders.FirstCommand>(entity).ResponsesToSend
     .Add(FirstCommand.CreateResponseFailure(Request, message));
 }