public void CategoryRetriever_Returns_Obese_If_Bmi_Is_Morethan_30() { var categoryRetriever = new CategoryRetriever(); WeightCategory category = categoryRetriever.GetWeightCategory(55); Assert.Equal(WeightCategory.Obese, category); }
public void CategoryRetriever_Returns_UnderWeight_If_Bmi_Is_Less_Than_185() { var categoryRetriever = new CategoryRetriever(); WeightCategory category = categoryRetriever.GetWeightCategory(10); Assert.Equal(WeightCategory.UnderWeight, category); }
public void CategoryRetriever_Returns_OverWeight_If_Bmi_Is_Exactly_299() { var categoryRetriever = new CategoryRetriever(); WeightCategory category = categoryRetriever.GetWeightCategory(25); Assert.Equal(WeightCategory.OverWeight, category); }
public void CategoryRetriever_Returns_NormalWeight_If_Bmi_Is_Exactly_249() { var categoryRetriever = new CategoryRetriever(); WeightCategory category = categoryRetriever.GetWeightCategory(24.9); Assert.Equal(WeightCategory.Normal, category); }
public Bmi(float weightInPounds, float heightInInches, float bmi, WeightCategory weightCategory) { _weightInPounds = weightInPounds; _heightInInches = heightInInches; _bmi = bmi; _weightCategory = weightCategory; }
protected override BaseItem serialize() { WeightCategory into = new WeightCategory() { WeightValue = WeightValue }; base.serialize(into); return(into); }
public void Init(string _baseName, string _Description, int _reqLvl, ItemQuality _Quality, WeightCategory _wgtCat, Slot _slot) { baseName = _baseName; Description = _Description; ReqLvl = Mathf.Max(_reqLvl, 0); Quality = _Quality; wgtCat = _wgtCat; slot = _slot; MaxStack = 1; Setup(); }
public async Task<IActionResult> UpdateWeightCategory([FromBody] WeightCategory category) { try { var userId = User.Identity.Name; category = await _organizerService.UpdateWeightCategoryAsync(category, userId); return Ok(category); } catch (Exception ex) { return BadRequest(ex.Message); } }
public async Task <WeightCategory> UpdateWeightCategoryAsync(WeightCategory category, string userId) { var existing = await GetWeightCategoryAsync(category.Id, userId);//this is more for cheking that category is for this user if (existing != null) { existing.Name = category.Name; existing.MinWeight = category.MinWeight; existing.MaxWeight = category.MaxWeight; _context.Update(existing); await _context.SaveChangesAsync(); } return(existing); }
public async Task <WeightCategory> AddWeightCategoryAsync(WeightCategory weightCategory, string userId) { var group = await _context .WeightCategoryGroups .FirstOrDefaultAsync(acg => acg.ApplicationUserId == userId && acg.Id == weightCategory.WeightCategoryGroupId); if (group != null) { _context.Add(weightCategory); await _context.SaveChangesAsync(); return(weightCategory); } throw new Exception("Could not add a category");//this should never happen }
protected override void deserialize(BaseItem item, List <SyncPropertyNames> changedProperties) { WeightCategory from = item as WeightCategory; if (changedProperties != null) { if (WeightValue != from.WeightValue) { changedProperties.Add(SyncPropertyNames.WeightValue); } } WeightValue = from.WeightValue; base.deserialize(from, changedProperties); }
private decimal CalculateDeliveryPrice(SizeCategory sizeCategory, WeightCategory weight) => (decimal)sizeCategory + (decimal)weight;
public void Update(WeightCategory weightCategory) { _context.Update(weightCategory); }
public void Delete(WeightCategory weightCategory) { _context.Remove(weightCategory); }
public void Add(WeightCategory weightCategory) { _context.Add(weightCategory); }
public string GetWeightCategoryString(double bmi) { WeightCategory category = GetWeightCategory(bmi); return(category.GetStringValue()); }
// POST: Roles/Delete/5 public async Task Delete(WeightCategory weightCategory) { _weightCategoryRepo.Delete(weightCategory); await _weightCategoryRepo.Save(); }
// POST: Roles/Edit/5 public async Task Update(WeightCategory weightCategory) { _weightCategoryRepo.Update(weightCategory); await _weightCategoryRepo.Save(); }
// POST: Roles/Create public async Task AddAndSave(WeightCategory weightCategory) { _weightCategoryRepo.Add(weightCategory); await _weightCategoryRepo.Save(); }