public override string ToString() { var draw = (Draw == null) ? false : true; return($"ID: {Id}, Name: {Name}, Line: {Line.ToString()}, Portions: {Portions.ToString()}, " + $"Ingredients: {Ingredients.Serialize(LibreR.Models.Enums.Serializer.OneLine)}, Draw: {draw}, Notes: {Notes}, Instructions: {Instructions}"); }
private void OnAddPortion(string value) { var portion = MenuItem.AddDefaultMenuPortion(Model); Portions.Add(new PortionViewModel(portion)); Workspace.Add(portion); }
public void New_ReturnsPortions() { var portions = new Portions(8, 10); Assert.Equal(10, portions.Maximum); Assert.Equal(8, portions.Minimum); }
public void DeletePortion() { TestUtils.Upload(c_fileName, c_folderName + "/" + c_fileName); Portions response = TestUtils.SlidesApi.DeletePortion(c_fileName, c_slideIndex, c_shapeIndex, c_paragraphIndex, c_portionIndex, c_password, c_folderName); Assert.AreEqual(1, response.Items.Count); }
public void GetSubshapePortions() { TestUtils.Upload(c_fileName, c_folderName + "/" + c_fileName); Portions response = TestUtils.SlidesApi.GetSubshapePortions(c_fileName, c_slideIndex, c_shapePath, 1, c_paragraphIndex, c_password, c_folderName); Assert.AreEqual(2, response.Items.Count); }
public AssetAllocation(IReadOnlyList <AssetPortion> portions) { Portions = portions ?? throw new ArgumentNullException(nameof(portions)); if (Portions.Count > 0 && Portions.Select(p => p.Portion).Sum() != 1.0M) { throw new ArgumentException("Sum of all portions must be 1."); } }
private void OnDeletePortion(string value) { if (SelectedPortion != null) { Workspace.Delete(SelectedPortion.Model); Model.Portions.Remove(SelectedPortion.Model); Portions.Remove(SelectedPortion); } }
public void DeleteSubshapePortionsIndexes() { TestUtils.Upload(c_fileName, c_folderName + "/" + c_fileName); Portions response = TestUtils.SlidesApi.DeleteSubshapePortions(c_fileName, c_slideIndex, c_shapePath, 1, c_paragraphIndex, new List <int> { 1 }, c_password, c_folderName); Assert.AreEqual(1, response.Items.Count); }
public MenuItemPortion AddPortion(string portionName, decimal price, string currencyCode) { var mip = new MenuItemPortion { Name = portionName, Price = price, MenuItemId = Id }; Portions.Add(mip); return(mip); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (Name != null) { hashCode = hashCode * 59 + Name.GetHashCode(); } if (Categories != null) { hashCode = hashCode * 59 + Categories.GetHashCode(); } if (Nutrients != null) { hashCode = hashCode * 59 + Nutrients.GetHashCode(); } if (CalorieConversionFactor != null) { hashCode = hashCode * 59 + CalorieConversionFactor.GetHashCode(); } if (ProteinConversionFactor != null) { hashCode = hashCode * 59 + ProteinConversionFactor.GetHashCode(); } if (Components != null) { hashCode = hashCode * 59 + Components.GetHashCode(); } if (Portions != null) { hashCode = hashCode * 59 + Portions.GetHashCode(); } if (CommonName != null) { hashCode = hashCode * 59 + CommonName.GetHashCode(); } if (Footnote != null) { hashCode = hashCode * 59 + Footnote.GetHashCode(); } if (SearchTerm != null) { hashCode = hashCode * 59 + SearchTerm.GetHashCode(); } if (Score != null) { hashCode = hashCode * 59 + Score.GetHashCode(); } return(hashCode); } }
public AssetAllocation(params AssetPortion[] portions) { const decimal tolerance = 0.001M; Portions = portions ?? throw new ArgumentNullException(nameof(portions)); if (Portions.Count > 0 && Math.Abs(Portions.Select(p => p.Portion).Sum() - 1.0M) > tolerance) { throw new ArgumentException("Sum of all portions must be 1."); } if (Portions.Count > 0 && Portions.Select(p => p.Ticker).Distinct().Count() != Portions.Count) { throw new ArgumentException("All tickers must be different."); } }
private void OnDeletePortion(string value) { if (SelectedPortion != null) { var c = Dao.Count <Recipe>(x => x.Portion.Id == SelectedPortion.Model.Id); if (c == 0) { if (SelectedPortion.Model.Id > 0 && Model.Id > 0) { _workspace.Delete(SelectedPortion.Model); } Model.Portions.Remove(SelectedPortion.Model); Portions.Remove(SelectedPortion); } } }
private void RefreshView() { var tempPoint = new List <PointT>(Points); tempPoint.Add(Points[0]); var path = new LinearPath(tempPoint.ToArray()); var reg = new Region(path); Solid plate = reg.ExtrudeAsSolid <Solid>(_thickness, 0.1); this.Portions.Clear(); foreach (var port in plate.Portions) { Portions.Add(port); } Regen(0); this.UpdateBoundingBox(new devDept.Eyeshot.TraversalParams()); }
public void MasterSlidePortions() { TestUtils.Upload(c_fileName, c_folderName + "/" + c_fileName); Portions portions = TestUtils.SlidesApi.GetSpecialSlidePortions( c_fileName, c_slideIndex, SpecialSlideType.MasterSlide, c_shapeIndex, c_paragraphIndex, c_password, c_folderName); Assert.AreEqual(c_portionCount, portions.Items.Count); Portion dto = new Portion { FontBold = Portion.FontBoldEnum.True, Text = "New portion" }; Portion portion = TestUtils.SlidesApi.CreateSpecialSlidePortion( c_fileName, c_slideIndex, SpecialSlideType.MasterSlide, c_shapeIndex, c_paragraphIndex, dto, password: c_password, folder: c_folderName); Assert.AreEqual(dto.FontBold, portion.FontBold); Assert.AreEqual(dto.Text, portion.Text); portions = TestUtils.SlidesApi.GetSpecialSlidePortions( c_fileName, c_slideIndex, SpecialSlideType.MasterSlide, c_shapeIndex, c_paragraphIndex, c_password, c_folderName); Assert.AreEqual(c_portionCount + 1, portions.Items.Count); Portion dto2 = new Portion { FontHeight = 22, Text = "Updated portion" }; portion = TestUtils.SlidesApi.UpdateSpecialSlidePortion( c_fileName, c_slideIndex, SpecialSlideType.MasterSlide, c_shapeIndex, c_paragraphIndex, c_portionCount + 1, dto2, c_password, c_folderName); Assert.AreEqual(dto.FontBold, portion.FontBold); Assert.AreEqual(dto2.FontHeight, portion.FontHeight); Assert.AreEqual(dto2.Text, portion.Text); portions = TestUtils.SlidesApi.GetSpecialSlidePortions( c_fileName, c_slideIndex, SpecialSlideType.MasterSlide, c_shapeIndex, c_paragraphIndex, c_password, c_folderName); Assert.AreEqual(c_portionCount + 1, portions.Items.Count); TestUtils.SlidesApi.DeleteSpecialSlidePortion( c_fileName, c_slideIndex, SpecialSlideType.MasterSlide, c_shapeIndex, c_paragraphIndex, c_portionCount + 1, c_password, c_folderName); portions = TestUtils.SlidesApi.GetSpecialSlidePortions( c_fileName, c_slideIndex, SpecialSlideType.MasterSlide, c_shapeIndex, c_paragraphIndex, c_password, c_folderName); Assert.AreEqual(c_portionCount, portions.Items.Count); }
/// <summary> /// Returns true if IngredientObjectItems instances are equal /// </summary> /// <param name="other">Instance of IngredientObjectItems to be compared</param> /// <returns>Boolean</returns> public bool Equals(IngredientObjectItems other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Name == other.Name || Name != null && Name.Equals(other.Name) ) && ( Categories == other.Categories || Categories != null && Categories.SequenceEqual(other.Categories) ) && ( Nutrients == other.Nutrients || Nutrients != null && Nutrients.SequenceEqual(other.Nutrients) ) && ( CalorieConversionFactor == other.CalorieConversionFactor || CalorieConversionFactor != null && CalorieConversionFactor.Equals(other.CalorieConversionFactor) ) && ( ProteinConversionFactor == other.ProteinConversionFactor || ProteinConversionFactor != null && ProteinConversionFactor.Equals(other.ProteinConversionFactor) ) && ( Components == other.Components || Components != null && Components.SequenceEqual(other.Components) ) && ( Portions == other.Portions || Portions != null && Portions.SequenceEqual(other.Portions) ) && ( CommonName == other.CommonName || CommonName != null && CommonName.Equals(other.CommonName) ) && ( Footnote == other.Footnote || Footnote != null && Footnote.Equals(other.Footnote) ) && ( SearchTerm == other.SearchTerm || SearchTerm != null && SearchTerm.Equals(other.SearchTerm) ) && ( Score == other.Score || Score != null && Score.Equals(other.Score) )); }