Exemple #1
0
        public void Stock_NotifyAll()
        {
            var stock            = new Stock("Apple", 100);
            var ohioTechInvestor = new OhioTechInvestor(stock);

            stock.NotifyAll();
            Assert.AreEqual(1, stock.Notified);
        }
Exemple #2
0
        public void Stock_NotifyAllWhenSetValue()
        {
            var stock               = new Stock("Apple", 100);
            var ohioTechInvestor    = new OhioTechInvestor(stock);
            var goldenSeedsInvestor = new GoldenSeedsInvestor(stock);

            stock.Value = 150;
            Assert.AreEqual(2, stock.Notified);
        }
Exemple #3
0
        static void Main(string[] args)
        {
            var stock               = new Stock("IBM", 100);
            var ohioTechInvestor    = new OhioTechInvestor(stock);
            var goldenSeedsInvestor = new GoldenSeedsInvestor(stock);

            stock.Value = 180;
            Console.ReadKey();
        }
Exemple #4
0
        public void Stock_AttachingInvestor()
        {
            var stock            = new Stock("Apple", 100);
            var ohioTechInvestor = new OhioTechInvestor();

            Assert.AreEqual(0, stock.GetNumOfInvestors());

            stock.attach(ohioTechInvestor);

            Assert.AreEqual(1, stock.GetNumOfInvestors());
        }