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); }
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(); Terminal terminal = new Terminal(manager); manager.AddObserver(terminal); //Act manager.UpdateFuelPrice(1.78); //Assert Assert.AreEqual(1.78, terminal.FuelPrice); }
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); }