public void TestPersistInsert()
        {
            string           addOrder = "<lzOrder accrued_interest =\"0\" ack_datetime=\"\" ack_datetime_local=\"\" ack_datetime_tz=\"0\" ack_id=\"\" ack_price=\"0\" allocated_qty=\"0\" allocated_val=\"0\" alternative_settlement_ccy=\"\" approved_datetime=\"\" approved_datetime_local=\"\" approved_datetime_tz=\"0\" approver_id=\"\" assigned_by=\"\" assigned_datetime=\"\" assigned_datetime_local=\"\" assigned_datetime_tz=\"0\" assigned_desk=\"DD01\" assigned_to=\"howars1\" ats_datetime=\"\" ats_status=\"\" auto_order_creation=\"0\" available_quantity=\"10000\" available_value=\"0\" avg_executed_points=\"0\" avg_executed_rate=\"0\" avg_executed_ref_rate=\"0\" avg_price=\"0\" avg_price_at=\"0\" avg_volume=\"330554322\" bid_price=\"0\" calculated_bloomberg_code=\"US5949181045 US Equity\" client_list_id=\"\" client_parent_list_id=\"\" client_root_list_id=\"\" clr_account=\"\" compliance_datetime=\"\" compliance_priority=\"0\" condition=\"M\" conf_executions_waiting=\"0\" conf_summary_status_id=\"0\" conf_systems=\"\" cont_id=\"\" contingent_status=\"0\" counterparty=\"\" coupon_rate=\"\" created_datetime=\"\" cross_count_instrument=\"1\" cross_count_issuer=\"0\" cross_indicator=\"1\" cross_own_all_instrument=\"0\" cross_own_all_issuer=\"0\" cross_type=\"\" currency_pair_mkt_conv=\"\" currency_quotation=\"USD\" currency_quotation2=\"\" current_face_qty=\"0\" custodian_id=\"\" dealer_discretion=\"1\" dealer_note=\"\" default_alloc_algo=\"0\" directed_alloc_qty=\"0\" directed_commission=\"\" directed_quantity=\"0\" directed_value=\"0\" done_for_day=\"0\" driving_qty=\"1\" effective_date=\"\" efp_ind=\"\" execs_exceed_limits=\"0\" executed_qty=\"0\" executed_qty2=\"0\" executed_qty2_at=\"0\" executed_qty_at=\"0\" executed_val=\"0\" executed_val_at=\"0\" executions_due=\"1\" exposure=\"0\" ext_order_id=\"\" far_executed_qty=\"0\" far_executed_qty2=\"0\" far_executed_qty2_at=\"0\" far_executed_qty_at=\"0\" far_exposure=\"0\" far_open_qty=\"0\" far_open_qty2=\"0\" far_original_qty=\"0\" far_original_qty2=\"0\" give_up_comm_cpty_id=\"\" give_up_method=\"\" has_acc_unposted_executions=\"0\" has_adjusted_accrued_interest=\"0\" has_adjusted_price=\"0\" has_cannot_use_cpty=\"0\" has_duplicates_diff_side=\"1\" has_duplicates_same_side=\"1\" has_must_use_cpty=\"0\" has_nonfinal_price=\"0\" has_nonmixing_accounts=\"0\" has_unallocated_executions=\"0\" has_unconfirmed_executions=\"0\" has_unposted_executions=\"0\" has_warehoused_executions=\"0\" in_roll_window=\"0\" inactivation_datetime=\"\" index_ratio=\"1\" index_ratio2=\"1\" instrument2_id=\"\" instrument2_name=\"\" instrument_bb=\"US5949181045 US Equity\" instrument_cusip=\"C2588174\" instrument_id=\"22905\" instrument_isin=\"US5949181046\" instrument_local=\"\" instrument_name=\"Microsoft Corp\" instrument_overrides=\"\" instrument_ric=\"MSFT.OQ\" instrument_sedol=\"2588174\" investment_decision=\"\" investor_id=\"\" is_characteristic=\"0\" is_closed_for_day=\"0\" is_manual_settle_date=\"N\" is_non_blocking=\"0\" is_open=\"1\" is_suspended=\"0\" is_swap=\"N\" is_tbd=\"0\" issue_date=\"\" issuer=\"\" last_release_cpty_id=\"ABN\" limit_price=\"\" link_id=\"\" list_id=\"L1\" manager_id=\"howars1\" mark_status=\"1\" market_convention=\"\" market_id=\"US\" market_price_tolerance_status=\"2\" maturity_date=\"\" merge_count_instrument=\"338\" merge_count_issuer=\"0\" merge_own_all_instrument=\"0\" merge_own_all_issuer=\"0\" merged_orders=\"\" minerva_instrument_type=\"1\" normal_market_size=\"0\" num_segments=\"1\" offer_price=\"0\" open_qty=\"10000\" open_qty2=\"0\" open_val=\"20000\" order_id=\"O181\" order_price=\"200\" order_price2=\"0\" order_type=\"1\" original_order_type=\"1\" original_qty=\"10000\" original_qty2=\"0\" original_val=\"20000\" paydown_factor=\"1\" paydown_factor2=\"1\" pledge_ratio=\"0\" points=\"0\" posting_level=\"0\" posting_status=\"\" pref_cpty_id=\"\" pref_cpty_mand=\"0\" pref_cpty_name=\"\" pref_cpty_office_id=\"\" pref_cpty_office_name=\"\" pref_price_basis=\"\" prevent_fill_accounts=\"0\" price_factor=\"0.01\" price_factor2=\"1\" price_fractional=\"0\" price_type=\"GROSS\" prime_account_id=\"\" quote_list_id=\"\" rank_fill_percent=\"0\" rate=\"0\" rate_tolerance_summary_status=\"0\" reactivate_type=\"0\" ref_instrument_id=\"\" ref_instrument_name=\"\" ref_price=\"0\" ref_rate=\"0\" release_qty=\"0\" release_qty_at=\"0\" release_status=\"31\" release_unit_type=\"Q\" release_val=\"0\" release_val_at=\"0\" repo_days_range=\"\" reroute_level=\"0\" reserve_val_at=\"0\" roll_state=\"\" rollover_by=\"\" rollover_datetime=\"2017050514393848\" rollover_datetime_local=\"\" rollover_datetime_tz=\"0\" rollover_utc_offset=\"0\" root_list_id=\"L1\" rounding_conventions=\"V1:V(2,0);P(Z);Q(2);Y(3)\" scheme_id=\"\" sector_id=\"\" segment_dates=\"\" sentinel_is_valid=\"3\" settle_date=\"\" settle_date2=\"\" side=\"B\" side2=\"\" side_codes=\"B\" side_codes2=\"\" source_id=\"excel\" spot_trade_date=\"\" status=\"0\" step_out_amount=\"0\" strategy_id=\"\" summary_status=\"0\" summary_status_at=\"0\" swap_pv01=\"0\" swap_tenor=\"\" swap_type=\"0\" tif=\"C\" tif_date=\"\" trade_date=\"2017050500000000\" trader_instruction=\"\" trader_limit=\"\" transaction_type=\"1\" unit_type=\"Q\" unwound_order_id=\"\" user_data1=\"\" user_data10=\"\" user_data11=\"\" user_data12=\"\" user_data13=\"\" user_data14=\"\" user_data15=\"\" user_data16=\"\" user_data17=\"\" user_data18=\"\" user_data19=\"\" user_data2=\"\" user_data20=\"\" user_data3=\"\" user_data4=\"\" user_data5=\"\" user_data6=\"\" user_data7=\"\" user_data8=\"\" user_data9=\"\" working_qty=\"0\" working_traders=\"\" working_val=\"0\" action=\"Added\" added_by=\"howars1\" added_datetime=\"2017050514393848\" added_datetime_local=\"2017050515393848\" added_datetime_tz=\"1\" dealing_desk=\"DD01\" dealing_notify=\",DD01\" desk_notify=\",DD01,DD10\" investment_desk=\"DD10\" investment_notify=\",DD10\" is_active=\"1\" transaction_id=\"178152\" updated_by=\"AutoReleaseServer\" updated_datetime=\"2018091813524396\" updated_datetime_local=\"2018091814524396\" updated_datetime_tz=\"1\" allocated_status=\"\" dual_alloc_algorithm_id=\"\" dual_alloc_profile_id=\"\" is_manual_settle_date2=\"N\" prime_broker_cpty_id=\"\" cash_equals_collateral=\"\" comm_type=\"\" exchange_id=\"\" instrument_fim=\"\" avg_price2=\"\" avg_price2_at=\"\" avg_spread=\"\" avg_spread_at=\"\" check_settlement_ccy=\"N\" executed_val2=\"\" executed_val2_at=\"\" fxoption_type=\"\" has_dupe=\"\" has_ptntl_unsolic_execs=\"\" has_sentinel_invalid=\"\" instrument_dfid_1=\"\" is_manual_effective_date=\"0\" market_price=\"\" pref_cpty_set_by=\"0\" repo_type_code=\"\" repo_type_id=\"\" stop_price=\"\" swap_pay_label=\"\" swap_receive_label=\"\" term_type=\"\" winning_quote_id=\"\" />";
            DBTestConnection dbConn   = new DBTestConnection();
            PersistenceDB    db       = TestHelper.GetTestPersistenceDBForOrders(dbConn);

            Assert.IsTrue(dbConn.IsConnected);

            TransactionElements transactionElements = new TransactionElements(1);
            var attrVals = XElement.Parse(addOrder).Attributes().Where(attr => !TestHelper.IgnoreElements.Contains(attr.Name.LocalName)).ToDictionary(attr => attr.Name.LocalName.ToLower(), attr => attr.Value);

            transactionElements.Elements.Add(new TransactionElement(1, "orders", "order_id", ActionType.Insert, attrVals));
            db.Persist(transactionElements);

            Assert.AreEqual(1, dbConn.CommittedTransactions.Count);
            Assert.AreEqual(attrVals.Count, dbConn.CommittedTransactions[0].First().parameters.Count());
        }
Esempio n. 2
0
 public Task Persist(TransactionElements tes)
 {
     return(Task.CompletedTask);
 }