public void Serialization()
        {
            IMessage abstractMessage = new AbstractMessageWrapper(TestUtil.GetAllSet());

            TestUtil.AssertAllFieldsSet(TestAllTypes.ParseFrom(abstractMessage.ToByteString()));
            Assert.AreEqual(TestUtil.GetAllSet().ToByteString(), abstractMessage.ToByteString());
        }
Beispiel #2
0
        //to add VMCollection for ContractName

        /*
         * public ObservableCollection<ContractVM> ContractVMCollection
         * {
         *  get;
         * } = new ObservableCollection<ContractVM>();
         */

        public override void OnMessageWrapperRegistered(AbstractMessageWrapper messageWrapper)
        {
            MessageWrapper.RegisterAction <PBMarketInfo, ExceptionMessage>
                ((uint)BusinessMessageID.MSG_ID_QUERY_EXCHANGE, OnMarketInfo, ErrorMsgAction);
            MessageWrapper.RegisterAction <PBPosition, ExceptionMessage>
                ((uint)BusinessMessageID.MSG_ID_QUERY_POSITION, OnQueryPosition, ErrorMsgAction);
            MessageWrapper.RegisterAction <PBPositionCompareList, ExceptionMessage>
                ((uint)BusinessMessageID.MSG_ID_QUERY_POSITION_DIFFER, OnQueryPositionDiffer, ErrorMsgAction);
            MessageWrapper.RegisterAction <PBAccountInfo, ExceptionMessage>
                ((uint)BusinessMessageID.MSG_ID_QUERY_ACCOUNT_INFO, OnFund, ErrorMsgAction);
            MessageWrapper.RegisterAction <PBOrderInfo, ExceptionMessage>
                ((uint)BusinessMessageID.MSG_ID_QUERY_ORDER, OnReturnOrder, ErrorMsgAction);
            MessageWrapper.RegisterAction <PBOrderInfo, ExceptionMessage>
                ((uint)BusinessMessageID.MSG_ID_ORDER_NEW, OnReturnOrder, ErrorMsgAction);
            MessageWrapper.RegisterAction <PBOrderInfo, ExceptionMessage>
                ((uint)BusinessMessageID.MSG_ID_ORDER_UPDATE, OnUpdateOrder, ErrorMsgAction);
            MessageWrapper.RegisterAction <PBTradeInfo, ExceptionMessage>
                ((uint)BusinessMessageID.MSG_ID_QUERY_TRADE, OnReturnTrade, ErrorMsgAction);
            MessageWrapper.RegisterAction <PBTradeInfo, ExceptionMessage>
                ((uint)BusinessMessageID.MSG_ID_TRADE_RTN, OnReturnTrade, ErrorMsgAction);
            MessageWrapper.RegisterAction <PBOrderInfo, ExceptionMessage>
                ((uint)BusinessMessageID.MSG_ID_ORDER_CANCEL, OnUpdateOrder, ErrorMsgAction);
            MessageWrapper.RegisterAction <PBPosition, ExceptionMessage>
                ((uint)BusinessMessageID.MSG_ID_POSITION_UPDATED, OnUpdatePosition, ErrorMsgAction);
            MessageWrapper.RegisterAction <PBPosition, ExceptionMessage>
                ((uint)BusinessMessageID.MSG_ID_EXCHANGE_POSITION_UPDATED, OnExchangeUpdatePosition, ErrorMsgAction);
        }
        public void SerializedSize()
        {
            TestAllTypes message         = TestUtil.GetAllSet();
            IMessage     abstractMessage = new AbstractMessageWrapper(TestUtil.GetAllSet());

            Assert.AreEqual(message.SerializedSize, abstractMessage.SerializedSize);
        }
        public void PackedParsing()
        {
            AbstractMessageWrapper.Builder builder = new AbstractMessageWrapper.Builder(TestPackedTypes.CreateBuilder());
            AbstractMessageWrapper         message = builder.MergeFrom(TestUtil.GetPackedSet().ToByteString()).Build();

            TestUtil.AssertPackedFieldsSet((TestPackedTypes)message.WrappedMessage);
        }
        public void Parsing()
        {
            IBuilder builder = new AbstractMessageWrapper.Builder(TestAllTypes.CreateBuilder());
            AbstractMessageWrapper message = (AbstractMessageWrapper)builder.WeakMergeFrom(TestUtil.GetAllSet().ToByteString()).WeakBuild();

            TestUtil.AssertAllFieldsSet((TestAllTypes)message.WrappedMessage);
        }
 public override void OnMessageWrapperRegistered(AbstractMessageWrapper messageWrapper)
 {
     MessageWrapper.RegisterAction <PBStrategyList, ExceptionMessage>
         ((uint)BusinessMessageID.MSG_ID_QUERY_STRATEGY, OnQueryStrategySuccessAction, OnErrorAction);
     MessageWrapper.RegisterAction <PBContractParamList, ExceptionMessage>
         ((uint)BusinessMessageID.MSG_ID_QUERY_CONTRACT_PARAM, OnQueryContractParamSuccessAction, OnErrorAction);
     MessageWrapper.RegisterAction <PBStrategy, ExceptionMessage>
         ((uint)BusinessMessageID.MSG_ID_MODIFY_STRATEGY, OnUpdateStrategySuccessAction, OnErrorAction);
     MessageWrapper.RegisterAction <Result, ExceptionMessage>
         ((uint)BusinessMessageID.MSG_ID_MODIFY_CONTRACT_PARAM, OnUpdateSuccessAction, OnErrorAction);
     MessageWrapper.RegisterAction <Result, ExceptionMessage>
         ((uint)BusinessMessageID.MSG_ID_MODIFY_USER_PARAM, OnUpdateSuccessAction, OnErrorAction);
     MessageWrapper.RegisterAction <PBUserInfoList, ExceptionMessage>
         ((uint)BusinessMessageID.MSG_ID_QUERY_TRADINGDESK, OnQueryTradingDeskSuccessAction, OnErrorAction);
     MessageWrapper.RegisterAction <PBPortfolioList, ExceptionMessage>
         ((uint)BusinessMessageID.MSG_ID_QUERY_PORTFOLIO, OnQueryPortfolioSuccessAction, OnErrorAction);
     MessageWrapper.RegisterAction <PBPortfolio, ExceptionMessage>
         ((uint)BusinessMessageID.MSG_ID_PORTFOLIO_NEW, OnPortfolioUpdated, OnErrorAction);
     MessageWrapper.RegisterAction <PBPortfolio, ExceptionMessage>
         ((uint)BusinessMessageID.MSG_ID_MODIFY_PORTFOLIO, OnPortfolioUpdated, OnErrorAction);
     MessageWrapper.RegisterAction <PBPortfolio, ExceptionMessage>
         ((uint)BusinessMessageID.MSG_ID_HEDGE_CONTRACT_UPDATE, OnPortfolioHedgeContracts, OnErrorAction);
     MessageWrapper.RegisterAction <PBStrategyList, ExceptionMessage>
         ((uint)BusinessMessageID.MSG_ID_MODIFY_PRICING_CONTRACT, OnQueryStrategySuccessAction, OnErrorAction);
     MessageWrapper.RegisterAction <PBInstrumentList, ExceptionMessage>
         ((uint)BusinessMessageID.MSG_ID_UNSUB_TRADINGDESK_PRICING, UnsubTDSuccessAction, OnErrorAction);
 }
        public void MergeFrom()
        {
            AbstractMessageWrapper result = (AbstractMessageWrapper)
                                            new AbstractMessageWrapper.Builder(TestAllTypes.CreateBuilder(MergeDest))
                                            .MergeFrom(MergeSource)
                                            .Build();

            Assert.AreEqual(MergeResultText, result.ToString());
        }
Beispiel #8
0
 public override void OnMessageWrapperRegistered(AbstractMessageWrapper messageWrapper)
 {
     MessageWrapper.RegisterAction <PBMarketDataList, ExceptionMessage>
         ((uint)BusinessMessageID.MSG_ID_SUB_MARKETDATA, SubMDSuccessAction, ErrorMsgAction);
     MessageWrapper.RegisterAction <SimpleStringTable, ExceptionMessage>
         ((uint)BusinessMessageID.MSG_ID_UNSUB_MARKETDATA, UnsubMDSuccessAction, ErrorMsgAction);
     MessageWrapper.RegisterAction <PBMarketData, ExceptionMessage>
         ((uint)BusinessMessageID.MSG_ID_RET_MARKETDATA, RetMDSuccessAction, ErrorMsgAction);
 }
Beispiel #9
0
 public override void OnMessageWrapperRegistered(AbstractMessageWrapper messageWrapper)
 {
     base.OnMessageWrapperRegistered(messageWrapper);
     MessageWrapper.RegisterAction <PBTradingDeskOptionParams, ExceptionMessage>
         ((uint)BusinessMessageID.MSG_ID_RTN_TRADINGDESK_PRICING, OnTradingDeskOptionParams, OnErrorAction);
 }
 public override void OnMessageWrapperRegistered(AbstractMessageWrapper messageWrapper)
 {
     base.OnMessageWrapperRegistered(messageWrapper);
     MessageWrapper.RegisterAction <PBPricingData, ExceptionMessage>(MSG_ID_RET_MD, OnReturningPricing, ErrorMsgAction);
 }
Beispiel #11
0
 public override void OnMessageWrapperRegistered(AbstractMessageWrapper messageWrapper)
 {
     MessageWrapper.RegisterAction <SimpleStringTable, ExceptionMessage>(MSG_ID_UNSUB_MD, UnsubMDSuccessAction, ErrorMsgAction);
     MessageWrapper.RegisterAction <PBMarketData, ExceptionMessage>(MSG_ID_RET_MD, RetMDSuccessAction, ErrorMsgAction);
 }
 public override void OnMessageWrapperRegistered(AbstractMessageWrapper messageWrapper)
 {
 }