/// <summary> /// Recipe description. /// </summary> /// <returns></returns> public override string ToString() { return(String.Format( "{0} ({1} mins prep time, serves {2})", this.Name, this.PreparationMinutes, ModelUtility.GetNumericDisplay(this.Servings)) .Trim()); }
public void GetDecimalDisplayTest() { Assert.IsTrue(ModelUtility.GetNumericDisplay(0M).Equals("0")); Assert.IsTrue(ModelUtility.GetNumericDisplay(1.0M).Equals("1")); Assert.IsTrue(ModelUtility.GetNumericDisplay(-1.0M).Equals("-1")); Assert.IsTrue(ModelUtility.GetNumericDisplay(1.1M).Equals("1.1")); Assert.IsTrue(ModelUtility.GetNumericDisplay(1.18M).Equals("1.18")); Assert.IsTrue(ModelUtility.GetNumericDisplay(1.181M).Equals("1.18")); Assert.IsTrue(ModelUtility.GetNumericDisplay(1.185M).Equals("1.18")); Assert.IsTrue(ModelUtility.GetNumericDisplay(1.1855M).Equals("1.19")); Assert.IsTrue(ModelUtility.GetNumericDisplay(12.3M).Equals("12.3")); Assert.IsTrue(ModelUtility.GetNumericDisplay(123M).Equals("123")); Assert.IsTrue(ModelUtility.GetNumericDisplay(1234M).Equals("1,234")); Assert.IsTrue(ModelUtility.GetNumericDisplay(1234567M).Equals("1,234,567")); Assert.IsTrue(ModelUtility.GetNumericDisplay(1234567890M).Equals("1,234,567,890")); }