本文整理汇总了C#中System.Collections.ArrayList.ToStringWithValues方法的典型用法代码示例。如果您正苦于以下问题:C# ArrayList.ToStringWithValues方法的具体用法?C# ArrayList.ToStringWithValues怎么用?C# ArrayList.ToStringWithValues使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Collections.ArrayList
的用法示例。
在下文中一共展示了ArrayList.ToStringWithValues方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RecievesTradeMarginMessagesForMoreThanTwoAllOpenPositions
public void RecievesTradeMarginMessagesForMoreThanTwoAllOpenPositions()
{
var gate = new ManualResetEvent(false);
var rpcClient = BuildRpcClient();
var accounts = rpcClient.AccountInformation.GetClientAndTradingAccount();
var openPositions = rpcClient.TradesAndOrders.ListOpenPositions(accounts.TradingAccounts[0].TradingAccountId);
Assert.That(openPositions.OpenPositions.Length, Is.GreaterThanOrEqualTo(3), "This test must be run using an account that has 3 or more open positions");
Console.WriteLine(string.Format(
"There are {0} open positions on markets: {1}",
openPositions.OpenPositions.Length,
openPositions.OpenPositions.Select(p => p.MarketId).ToList().ToStringWithValues()));
var streamingClient = rpcClient.CreateStreamingClient();
var tradeMarginListener = streamingClient.BuildTradeMarginListener();
var marketsThatTradeMarginHasBeenRecievedFor = new ArrayList();
tradeMarginListener.MessageReceived += (s, e) =>
{
Console.WriteLine(
string.Format(
"TradeMarginDTO recieved for market {0}",
e.Data.MarketId));
if (marketsThatTradeMarginHasBeenRecievedFor.Contains(e.Data.MarketId)) return;
marketsThatTradeMarginHasBeenRecievedFor.Add(e.Data.MarketId);
if (openPositions.OpenPositions.Length == marketsThatTradeMarginHasBeenRecievedFor.Count)
{
gate.Set();
}
};
try
{
if (!gate.WaitOne(TimeSpan.FromMinutes(1)))
{
Assert.Fail("TradeMarginDTO message not recieved for all open positions. OpenPositions on markets: {0} but only recieved TradeMarginDTOs for markets {1}",
openPositions.OpenPositions.Select(p => p.MarketId).ToStringWithValues(),
marketsThatTradeMarginHasBeenRecievedFor.ToStringWithValues());
}
}
finally
{
Console.WriteLine(string.Format(
"OpenPositions on markets: {0}, Recieved TradeMarginDTOs for markets {1}",
openPositions.OpenPositions.Select(p => p.MarketId).ToStringWithValues(),
marketsThatTradeMarginHasBeenRecievedFor.ToStringWithValues()));
streamingClient.TearDownListener(tradeMarginListener);
streamingClient.Dispose();
}
}