Exemplo n.º 1
0
        /// <summary>
        ///RandomArray 的测试
        ///</summary>
        public void RandomArrayTestHelper <T>()
        {
            T[] arrayT   = null;       // TODO: 初始化为适当的值
            T   expected = default(T); // TODO: 初始化为适当的值
            T   actual;

            actual = RandomEx.RandomArray <T>(arrayT);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("验证此测试方法的正确性。");
        }
Exemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ButtonFile_Click(object sender, EventArgs e)
        {
            char[] codeArray = this.RichTextBoxCode.Text.ToCharArray();
            char[] nameArray = this.RichTextBoxName.Text.ToCharArray();

            for (int iIndex = 0; iIndex < m_RandomFileCount; iIndex++)
            {
                StockInfo stockInfo = new StockInfo();

                StringBuilder strCode = new StringBuilder();
                for (int i = 0; i < 6; i++)
                {
                    strCode.Append(RandomEx.RandomArray(codeArray));
                }

                StringBuilder strName = new StringBuilder();
                for (int i = 0; i < 10; i++)
                {
                    strName.Append(RandomEx.RandomArray(nameArray));
                }

                //stockInfo.StockCode = strCode.ToString();
                //stockInfo.StockName = strName.ToString();

                DateTime[] allTradingTime = this.GetAllTradingTime();

                for (int iIndex2 = 0; iIndex2 < allTradingTime.Length; iIndex2++)
                {
                    StockData stockData = new StockData();

                    stockData.TradingTime   = allTradingTime[iIndex2];
                    stockData.OpenPrice     = this.GetRandomOpenPrice();
                    stockData.ClosePrice    = this.GetRandomClosePrice();
                    stockData.HighestPrice  = this.GetRandomHighestPrice();
                    stockData.MinimumPrice  = this.GetRandomMinimumPrice((uint)stockData.HighestPrice);
                    stockData.TradingVolume = this.GetRandomDailyTurnover();
                    stockData.OpenInterest  = this.GetRandomDailyAmount();

                    //stockInfo.AddStockData( stockData );
                }

                StockInfo.SaveFileFormatForDStock(this.TextBoxFolder.Text + "\\" + stockInfo.StockCode + ".DStock", stockInfo);
            }
        }