public void Stock_NotifyAll() { var stock = new Stock("Apple", 100); var ohioTechInvestor = new OhioTechInvestor(stock); stock.NotifyAll(); Assert.AreEqual(1, stock.Notified); }
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); }
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(); }
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()); }