コード例 #1
0
        public static void RefreshTable(StockCollection stockCollection, V_GetStockPriceDelegate getStockPrice, ListView listViewStocks)
        {
            var stockValues   = V_StockValuator.GetStockValues(stockCollection, getStockPrice);
            var lineInfos     = V_Formatter.GetLineInfos(stockValues);
            var listViewItems = lineInfos.Select(CreateListViewItem).ToArray();

            listViewStocks.Items.Clear();
            listViewStocks.Items.AddRange(listViewItems);
        }
コード例 #2
0
        public void when_I_call_GetLineInfos_with_two_stocks__the_line_infos_are_correct()
        {
            var stockValues = new List <StockValue>()
            {
                new StockValue(new Stock("MSFT", 100, 100, "5/10/2020"), 15.0, 25.0, 33.0),
                new StockValue(new Stock("GOOG", 300, 400, "6/10/2020"), 15.0, 25.0, 33.0)
            };

            var lineInfos = V_Formatter.GetLineInfos(stockValues);

            lineInfos.Should().Equal(
                new V_LineInfo("MSFT", 15.0, 100.0, 25.0, 33.0),
                new V_LineInfo("GOOG", 15.0, 300.0, 25.0, 33.0),
                new V_LineInfo("------", "-", "-", "-"),
                new V_LineInfo("Total", "-", "-", 50.0, 66.0)
                );
        }