Beispiel #1
0
        public void Run()
        {
            Test.Initialize();

            Guid test = new Guid("8b265223-dc9e-4789-a6df-69d19f644ad7");

            /**
             * State sent to Saga
             * ***/
            SendCommand command = new SendCommand();
            command.RequestId = test;
            command.state = MyMessages.MessageParts.StateCodes.SentMyWCFClient;
            /**
             * State sent to WCF CLient
             * ***/
            ResponseCommand resp = new ResponseCommand();
            resp.RequestId = test;
            resp.state = MyMessages.MessageParts.StateCodes.CompleteMyWCFClient;

            Test.Saga<PaymentRequestSaga>()
                  .ExpectTimeoutToBeSetIn<SendCommand>((state, span) => span == TimeSpan.FromHours(3))
                .ExpectSend<SendCommand>()
                .ExpectReplyToOrginator<ResponseCommand>()
                .When(s => s.Handle(command));

            Test.Saga<PaymentRequestSaga>()
                 .ExpectReplyToOrginator<ResponseCommand>()
                 .When(s => s.Handle(resp));

            Test.Saga<PaymentRequestSaga>()
                 .ExpectSend<ResponseCommand>()
               .WhenSagaTimesOut();
        }
Beispiel #2
0
        public void TestMethod1()
        {
            //Use a single queue
            Configure.ScaleOut(s => s.UseSingleBrokerQueue());

            _startableBus = Configure.With()
               .DefaultBuilder()
               .RijndaelEncryptionService()
               .UseTransport<Msmq>()
               .UnicastBus()
               .CreateBus();

            Configure.Instance.ForInstallationOn<Windows>().Install();

            /**
              * State sent to Saga
              * ***/
            SendCommand command = new SendCommand();
            command.RequestId = new Guid("8b265223-dc9e-4789-a6df-69d19f644ad7");
            command.state = MyMessages.MessageParts.StateCodes.SentMySaga;

            _bus = _startableBus.Start();

            _bus.Send(command);
        }
Beispiel #3
0
        public void Run()
        {
            Test.Initialize();

            PayMessage message = new PayMessage();

            Guid test = new Guid("8b265223-dc9e-4789-a6df-69d19f644ad7");

            SendCommand command = new SendCommand();
            command.RequestId = test;
            command.state = MyMessages.MessageParts.StateCodes.SentMyWCFClient;

            Test.Handler<EventMessageHandler>()
                   .ExpectReply<ResponseCommand>(m=>m.state == MyMessages.MessageParts.StateCodes.CompleteMyWCFClient)
                     .OnMessage<SendCommand>(command);
        }
Beispiel #4
0
        public ActionResult SendSaga(int id)
        {
            //Get the GUID from the available XML files fro, the id passed from the page
            var user = new XMLLoads().GetPayments().Where(p => p.Id == id).FirstOrDefault();
            var message = new XMLLoads().GetMessages().Where(p => p.EventId == user.EventId).FirstOrDefault();

            // Create the send
            SendCommand command = new SendCommand();
            command.RequestId = message.EventId;
            command.state = StateCodes.SentMySaga;

            // Change the state in the EF DAL
            MVCAppDAL dal = new MVCAppDAL();
            dal.changeState(command.RequestId, command.state);

            // Send the command on the Bus
            MvcApplication.Bus.Send(command);

            return View(user);
        }