public void CloseValveWhenPotIsPresent( [Frozen] Mock <ICoffeeMaker> hardwareMock, ReliefValve sut) { sut.OnNext(WarmerPlateStatus.POT_NOT_EMPTY); hardwareMock.Verify( hw => hw.SetReliefValveState(ReliefValveState.CLOSED)); }
public void OpenValveWhenRemovingPotFromWarmerPlate( [Frozen] Mock <ICoffeeMaker> hardwareMock, ReliefValve sut) { sut.OnNext(WarmerPlateStatus.WARMER_EMPTY); hardwareMock.Verify( hw => hw.SetReliefValveState(ReliefValveState.OPEN)); }
public void OnErrorDoesNotThrowNotImplementedException( ReliefValve sut, Exception e) { try { sut.OnError(e); } catch (NotImplementedException) { Assert.True(false, "NotImplementedException thrown."); } }
static void Main(string[] args) { var hardware = new CoffeMakerInMemory(); hardware.SetReliefValveState(ReliefValveState.CLOSED); hardware.WarmerPlateStatus = WarmerPlateStatus.POT_EMPTY; var buttonEvents = Observable .Interval(TimeSpan.FromSeconds(1)) .Select(_ => hardware.GetBrewButtonStatus()) .Publish(); var boilerEvents = Observable .Interval(TimeSpan.FromSeconds(1)) .Select(_ => hardware.GetBoilerStatus()) .Publish(); var warmerEvents = Observable .Interval(TimeSpan.FromSeconds(1)) .Select(_ => hardware.GetWarmerPlateStatus()) .Publish(); var boiler = new Boiler(hardware); var indicator = new Indicator(hardware); var valve = new ReliefValve(hardware); var warmer = new WarmerPlate(hardware); using (buttonEvents.Subscribe(boiler)) using (buttonEvents.Subscribe(indicator)) using (boilerEvents.Subscribe(boiler)) using (boilerEvents.Subscribe(indicator)) using (warmerEvents.Subscribe(valve)) using (warmerEvents.Subscribe(warmer)) { buttonEvents.Connect(); boilerEvents.Connect(); warmerEvents.Connect(); while (!Exit(hardware)) { WriteHardwareState(hardware); } } }
public void OnNextWarmerEmptyDoesNotThrow(ReliefValve sut) { Assert.DoesNotThrow(() => sut.OnNext(WarmerPlateStatus.WARMER_EMPTY)); }
public void OnCompletedDoesNotThrow(ReliefValve sut) { Assert.DoesNotThrow(() => sut.OnCompleted()); }
public void SutIsObserverOfWarmerPlateStatus(ReliefValve sut) { Assert.IsAssignableFrom <IObserver <WarmerPlateStatus> >(sut); }
public void OnCompletedDoesNotThrow(ReliefValve sut) { sut.OnCompleted(); }