Fetch the repository succeeded.
This action will force synchronization from 懒得勤快/Masuit.Tools, which will overwrite any changes that you have made since you forked the repository, and can not be recovered!!!
Synchronous operation will process in the background and will refresh the page when finishing processing. Please be patient.
using Masuit.Tools.Strings;
using Xunit;
namespace Masuit.Tools.UnitTest
{
public class NumberFormaterTest
{
[Theory]
[InlineData(2, 16, "10000")]
[InlineData(8, 8, "10")]
[InlineData(16, 16, "10")]
[InlineData(36, 36, "10")]
[InlineData(62, 62, "10")]
public void Can_ConvertOct2AnySystem(int bin, long input, string expectOutput)
{
var nf = new NumberFormater(bin);
string output = nf.ToString(input);
Assert.Equal(expectOutput, output);
}
[Theory]
[InlineData(2, "10000", 16)]
[InlineData(8, "10", 8)]
[InlineData(16, "10", 16)]
[InlineData(36, "10", 36)]
[InlineData(62, "10", 62)]
public void Can_ConvertAnySystem2Oct(int bin, string input, long expected)
{
var nf = new NumberFormater(bin);
string output = nf.ToString(expected);
Assert.Equal(input, output);
}
[Fact]
public void Can_ConvertAnyNum2Chinese()
{
// arrange
double num = 1234567809.321;
// act
var chineseNumber = NumberFormater.ToChineseNumber(num);
// assert
Assert.Equal("十二亿三千四百五十六万七千八百零九点三二一", chineseNumber);
}
[Fact]
public void Can_ConvertAnyNum2ChineseMoney()
{
// arrange
double num = 123456789.321;
// act
var chineseNumber = NumberFormater.ToChineseMoney(num);
// assert
Assert.Equal("壹億贰仟叁佰肆拾伍萬陆仟柒佰捌拾玖元叁角贰分", chineseNumber);
}
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。