Beispiel #1
0
        public void Handle(Message message)
        {
            if (message.Type.Contains("ProposalSubmitted"))
            {
                MessageExchangeReader reader = MessageExchangeReader.From(message);
                string   proposalId          = reader.PayloadStringValue("proposalId");
                long     price    = reader.PayloadLongValue("price");
                string[] keywords = reader.PayloadStringValue("keywords").Split(",");

                API.PricingVerification.VerifyPricing(proposalId, price, keywords);
            }
        }
        public void TestExchangeRoundTrip()
        {
            TestableDomainEvent domainEvent = new TestableDomainEvent(1, "something");
            string  serializedDomainEvent   = Serialization.Serialize(domainEvent);
            Message eventMessage            = new Message(Convert.ToString(domainEvent.Id), domainEvent.GetType().Name, serializedDomainEvent);
            MessageExchangeReader reader    = MessageExchangeReader.From(eventMessage);

            Assert.AreEqual(eventMessage.Id, reader.Id);
            Assert.AreEqual(eventMessage.Type, reader.Type);
            Assert.AreEqual(domainEvent.Id, reader.IdAsLong);
            Assert.AreEqual(domainEvent.Name, reader.PayloadStringValue("name"));
            Assert.AreEqual(domainEvent.EventVersion, reader.PayloadIntegerValue("eventVersion"));
            Assert.AreEqual(domainEvent.OccurredOn, reader.PayloadLongValue("occurredOn"));
        }
        public void Handle(Message message)
        {
            if (message.Type.Contains("PricingVerified"))
            {
                MessageExchangeReader reader = MessageExchangeReader.From(message);
                string proposalId            = reader.PayloadStringValue("originatorId");

                API.ProposalCommands.VerifyPricing(proposalId);
            }
            else if (message.Type.Contains("PricingRejected"))
            {
                MessageExchangeReader reader = MessageExchangeReader.From(message);
                string proposalId            = reader.PayloadStringValue("originatorId");
                long   suggestedPrice        = reader.PayloadLongValue("suggestedPrice");

                API.ProposalCommands.DenyPricing(proposalId, suggestedPrice);
            }
        }
        public void Handle(Message message)
        {
            if (message.Type.Contains("SchedulingVerified"))
            {
                MessageExchangeReader reader = MessageExchangeReader.From(message);
                string proposalId            = reader.PayloadStringValue("originatorId");

                API.ProposalCommands.VerifyScheduling(proposalId);
            }
            else if (message.Type.Contains("SchedulingRejected"))
            {
                MessageExchangeReader reader = MessageExchangeReader.From(message);
                string proposalId            = reader.PayloadStringValue("originatorId");
                long   suggestedCompletedBy  = reader.PayloadLongValue("suggestedCompletedBy");

                API.ProposalCommands.DenyScheduling(proposalId, new DateTime(suggestedCompletedBy));
            }
        }