public async Task <IActionResult> PutBoilerStatus(long id, BoilerStatus boilerStatus)
        {
            if (id != boilerStatus.Id)
            {
                return(BadRequest());
            }

            _context.Entry(boilerStatus).State = EntityState.Modified;
            boilerStatus.UpdateTime            = DateTime.Now;
            boilerStatus.UserId = Constants.defaultUserName;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!BoilerStatusExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public void ConstructorSetsCorrect_IsElementOn(bool IsElementOn, bool IsPumpOn, bool IsBurstOn, bool IsAuto, decimal TargetTemp, decimal TempOffset, decimal ActualTemp, bool Expected)
        {
            Boiler       b  = new Boiler(IsElementOn, IsPumpOn, IsBurstOn, IsAuto, TargetTemp, TempOffset, ActualTemp);
            BoilerStatus bs = new BoilerStatus(b);

            Assert.Equal(bs.IsElementOn, Expected);
        }
 public void OnNext(BoilerStatus value)
 {
     this.hasWater = value == BoilerStatus.NOT_EMPTY;
     if (!this.hasWater)
     {
         this.hardware.SetBoilerState(BoilerState.OFF);
     }
 }
Exemple #4
0
 public void Poll(BoilerStatus boilerStatus, BrewButtonStatus brewButtonStatus, WarmerPlateStatus warmerPlateStatus)
 {
     if (boilerStatus == BoilerStatus.NOT_EMPTY &&
         brewButtonStatus == BrewButtonStatus.PUSHED &&
         warmerPlateStatus != WarmerPlateStatus.WARMER_EMPTY)
         coffeeMaker.SetBoilerState(BoilerState.ON);
     else
         coffeeMaker.SetBoilerState(BoilerState.OFF);
 }
Exemple #5
0
 public void Poll(BoilerStatus boilerStatus, WarmerPlateStatus warmerPlateStatus, BrewButtonStatus brewButtonStatus)
 {
     if (boilerStatus == BoilerStatus.EMPTY &&
         warmerPlateStatus != WarmerPlateStatus.POT_EMPTY &&
         brewButtonStatus == BrewButtonStatus.PUSHED)
     {
         coffeeMaker.SetIndicatorState(IndicatorState.ON);
         coffeeMaker.GetBrewButtonStatus();
     }
 }
        public async Task <ActionResult <BoilerStatus> > PostBoilerStatus(BoilerStatus boilerStatus)
        {
            boilerStatus.UpdateTime = DateTime.Now;
            boilerStatus.UserId     = Constants.defaultUserName;

            _context.BoilerStatus.Add(boilerStatus);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetBoilerStatus", new { id = boilerStatus.Id }, boilerStatus));
        }
 public M4CoffeeMakerApi()
 {
     warmerPlateStatus = WarmerPlateStatus.WARMER_EMPTY;
     boilerStatus      = BoilerStatus.EMPTY;
     boilerState       = BoilerState.OFF;
     brewButtonStatus  = BrewButtonStatus.NOT_PUSHED;
     warmerState       = WarmerState.OFF;
     indicatorState    = IndicatorState.OFF;
     reliefValveState  = ReliefValveState.CLOSED;
 }
Exemple #8
0
 public void SetReliefValveState(ReliefValveState state)
 {
     if (state == ReliefValveState.Open)
     {
         _boilerStatus     = BoilerStatus.NotEmpty;
         _warmerStatus     = WarmerPlateStatus.PotEmpty;
         _brewButtonStatus = BrewButtonStatus.Pushed;
         return;
     }
     _boilerStatus     = BoilerStatus.Empty;
     _warmerStatus     = WarmerPlateStatus.PotNotEmpty;
     _brewButtonStatus = BrewButtonStatus.NotPushed;
 }
Exemple #9
0
 public void SetIndicatorState(IndicatorState state)
 {
     if (state == IndicatorState.On)
     {
         _boilerStatus     = BoilerStatus.Empty;
         _warmerStatus     = WarmerPlateStatus.PotNotEmpty;
         _brewButtonStatus = BrewButtonStatus.NotPushed;
         return;
     }
     _boilerStatus     = BoilerStatus.NotEmpty;
     _warmerStatus     = WarmerPlateStatus.PotEmpty;
     _brewButtonStatus = BrewButtonStatus.Pushed;
 }
        public void Poll()
        {
            BoilerStatus boilerStatus = api.GetBoilerStatus();

            if (isBrewing)
            {
                if (boilerStatus == BoilerStatus.EMPTY)
                {
                    api.SetBoilerState(BoilerState.OFF);
                    api.SetReliefValveState(ReliefValveState.CLOSED);
                    DeclareDone();
                }
            }
        }
        public void Preparando()
        {
            BoilerStatus boilerStatus = _api.GetBoilerStatus();

            if (EstaFermentando)
            {
                if (boilerStatus == BoilerStatus.EMPTY)
                {
                    _api.SetBoilerState(BoilerState.OFF);
                    _api.SetReliefValveState(ReliefValveState.CLOSED);
                    DeclareTerminado();
                }
            }
        }
 public void LogBoilerStatus(BoilerStatus item)
 {
     isLogBoilerStatus = true;
 }
        public override bool EstaTerminado()
        {
            BoilerStatus boilerStatus = _api.GetBoilerStatus();

            return(boilerStatus == BoilerStatus.NOT_EMPTY);
        }
        public override bool IsReady()
        {
            BoilerStatus status = CoffeeMaker.api.GetBoilerStatus();

            return(status == BoilerStatus.NOT_EMPTY);
        }
Exemple #15
0
 public void Poll(BoilerStatus boilerStatus, BrewButtonStatus brewButtonStatus)
 {
     if (boilerStatus == BoilerStatus.NOT_EMPTY &&
         brewButtonStatus == BrewButtonStatus.PUSHED)
         coffeeMaker.SetIndicatorState(IndicatorState.OFF);
 }
        public override bool IsReady()
        {
            BoilerStatus boilerStatus = api.GetBoilerStatus();

            return(boilerStatus == BoilerStatus.NOT_EMPTY);
        }
 protected internal void SetBoilerStatus(BoilerStatus boilerStatus)
 {
     BoilerStatus = boilerStatus;
 }
Exemple #18
0
 public void LogBoilerStatus(BoilerStatus item)
 {
     isLogBoilerStatus = true;
 }
 public void ConstructorSetsCorrect_TempOffset(bool IsElementOn, bool IsPumpOn, bool IsBurstOn, bool IsAuto, decimal TargetTemp, decimal TempOffset, decimal ActualTemp, decimal Expected)
 {
     Boiler b = new Boiler(IsElementOn, IsPumpOn, IsBurstOn, IsAuto, TargetTemp, TempOffset, ActualTemp);
     BoilerStatus bs = new BoilerStatus(b);
     Assert.Equal(bs.ActualTemp, Expected);
 }