public void TestDefinedStockRemove()
        {
            IDefinedStockContainer definedStockContainer = StockContainerCreator.GetDefinedStockContainer();

            definedStockContainer.Add(new Stock()
            {
                Name = "AAPL", ID = "AAPL"
            });
            definedStockContainer.Add(new Stock()
            {
                Name = "BIOX", ID = "BIOX"
            });
            definedStockContainer.Add(new Stock()
            {
                Name = "GHM", ID = "GHM"
            });
            definedStockContainer.Add(new Stock()
            {
                Name = "PALL", ID = "PALL"
            });
            definedStockContainer.Add(new Stock()
            {
                Name = "TRTY", ID = "TRTY"
            });
            definedStockContainer.Remove("AAPL");
            Assert.IsTrue(4 == definedStockContainer.Stocks.Count);
        }
示例#2
0
        private void btnRemove_Click(object sender, EventArgs e)
        {
            bool isRemoved = false;

            foreach (DataGridViewRow dr in dtGrdDefined.Rows)
            {
                var sel = dr.Cells[0].Value as bool?;

                if (sel.HasValue && sel.Value)
                {
                    definedStockContainer.Remove((string)dr.Cells[1].Value);
                    isRemoved = true;
                }
            }

            if (isRemoved)
            {
                LoadStocks();
            }
        }