public void GetsPriceOnInstantiation() { //Arrange PricingManager manager = new PricingManager(1.00); //Act FuelPriceDisplay display = new FuelPriceDisplay(manager); //Assert Assert.AreEqual(1.0, display.FuelPrice); }
public void AddObserverAddsObserver() { //Arrange PricingManager manager = new PricingManager(); FuelPriceDisplay display = new FuelPriceDisplay(manager); //Act manager.AddObserver(display); //Assert Assert.AreEqual(1, manager.Observers.Count); }
public void GetsNotifiedonFuelPriceChange() { //Arrange PricingManager manager = new PricingManager(); FuelPriceDisplay display = new FuelPriceDisplay(manager); manager.AddObserver(display); //Act manager.UpdateFuelPrice(1.78); //Assert Assert.AreEqual(1.78, display.FuelPrice); }
public void RemoveObserverRemovesObserver() { //Arrange PricingManager manager = new PricingManager(); FuelPriceDisplay display = new FuelPriceDisplay(manager); Terminal terminal = new Terminal(manager); //Act manager.AddObserver(display); manager.AddObserver(terminal); manager.RemoveObserver(display); //Assert Assert.AreEqual(1, manager.Observers.Count); }