/// <summary> /// Asynchronously builds a name of the associated instance /// </summary> /// <param name="culture">A <see cref="CultureInfo" /> specifying the language of the constructed name</param> /// <returns>A <see cref="Task{String}" /> representing the asynchronous operation</returns> /// <exception cref="NameExpressionException">The specified specifier does not exist or it's value is not string representation of decimal</exception> public async Task <string> BuildNameAsync(CultureInfo culture) { var value = await _operand.GetDecimalValue().ConfigureAwait(false); var result = SdkInfo.DecimalToStringWithSign(value); return(result); }
public void DecimalToStringTest() { var nbrString = "0"; var nbr = decimal.Parse(nbrString); Assert.AreEqual("0", SdkInfo.DecimalToStringWithSign(nbr), $"Expecting: 0, Received: {SdkInfo.DecimalToStringWithSign(nbr)}."); nbrString = "-0"; nbr = decimal.Parse(nbrString); Assert.AreEqual("0", SdkInfo.DecimalToStringWithSign(nbr), $"Expecting: 0, Received: {SdkInfo.DecimalToStringWithSign(nbr)}."); nbrString = "+0.25"; nbr = decimal.Parse(nbrString); Assert.AreEqual("+0.25", SdkInfo.DecimalToStringWithSign(nbr), $"Expecting: +0.25, Received: {SdkInfo.DecimalToStringWithSign(nbr)}."); nbrString = "+0.5"; nbr = decimal.Parse(nbrString); Assert.AreEqual("+0.5", SdkInfo.DecimalToStringWithSign(nbr), $"Expecting: +0.5, Received: {SdkInfo.DecimalToStringWithSign(nbr)}."); nbrString = "+0.75"; nbr = decimal.Parse(nbrString); Assert.AreEqual("+0.75", SdkInfo.DecimalToStringWithSign(nbr), $"Expecting: +0.75, Received: {SdkInfo.DecimalToStringWithSign(nbr)}."); nbrString = "+1"; nbr = decimal.Parse(nbrString); Assert.AreEqual("+1", SdkInfo.DecimalToStringWithSign(nbr), $"Expecting: +1, Received: {SdkInfo.DecimalToStringWithSign(nbr)}."); nbrString = "0.75"; nbr = decimal.Parse(nbrString); Assert.AreEqual("+0.75", SdkInfo.DecimalToStringWithSign(nbr), $"Expecting: +0.75, Received: {SdkInfo.DecimalToStringWithSign(nbr)}."); nbrString = "1"; nbr = decimal.Parse(nbrString); Assert.AreEqual("+1", SdkInfo.DecimalToStringWithSign(nbr), $"Expecting: +1, Received: {SdkInfo.DecimalToStringWithSign(nbr)}."); nbrString = "-0.75"; nbr = decimal.Parse(nbrString); Assert.AreEqual(nbrString, SdkInfo.DecimalToStringWithSign(nbr), $"Expecting: {nbrString}, Received: {SdkInfo.DecimalToStringWithSign(nbr)}."); nbrString = "-1"; nbr = decimal.Parse(nbrString); Assert.AreEqual(nbrString, SdkInfo.DecimalToStringWithSign(nbr), $"Expecting: {nbrString}, Received: {SdkInfo.DecimalToStringWithSign(nbr)}."); nbrString = "-1.75"; nbr = decimal.Parse(nbrString); Assert.AreEqual(nbrString, SdkInfo.DecimalToStringWithSign(nbr), $"Expecting: {nbrString}, Received: {SdkInfo.DecimalToStringWithSign(nbr)}."); }