コード例 #1
0
ファイル: StockExchangeTests.cs プロジェクト: Rep2/OO_2.dz
        public void Test_ListStock_Simple()
        {
            Assert.AreEqual(0, _stockExchange.NumberOfStocks());
            string firstStockName = "IBM";
            _stockExchange.ListStock(firstStockName, 1000000, 10m, DateTime.Now);

            Assert.AreEqual(1, _stockExchange.NumberOfStocks());
            Assert.True(_stockExchange.StockExists(firstStockName));
            Assert.False(_stockExchange.StockExists("Bezveze"));

            string secondStockName = "MSFT";
            _stockExchange.ListStock(secondStockName, 100000, 15m, DateTime.Now);
            Assert.AreEqual(2, _stockExchange.NumberOfStocks());
            Assert.True(_stockExchange.StockExists(secondStockName));
        }
コード例 #2
0
        public void Test_DelistStock_Simple()
        {
            // Postojeća dionica miče se s burze

            string dionica1 = "Dionica1";

            _stockExchange.ListStock(dionica1, 1000000, 10m, DateTime.Now);

            Assert.True(_stockExchange.StockExists(dionica1));
            Assert.AreEqual(1, _stockExchange.NumberOfStocks());

            _stockExchange.DelistStock(dionica1);

            Assert.False(_stockExchange.StockExists(dionica1));
            Assert.AreEqual(0, _stockExchange.NumberOfStocks());
        }