Files
zszq-trs/YLErpUnitTest/CoreTests/OtcFormatTest.cs
T
2024-05-09 14:06:26 +08:00

54 lines
1.2 KiB
C#

using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using YLErp.Models;
namespace YLErp.CoreTests
{
[TestClass]
public class OtcFormatTest
{
[TestMethod]
public void Test1()
{
var opt = new OtcFormatOption
{
grouping = true,
rounded = false,
precision = 0
};
Assert.AreEqual(opt.Format(1111.55555), "1,111");
opt = new OtcFormatOption
{
grouping = true,
rounded = false,
precision = 2
};
Assert.AreEqual(opt.Format(1111.55555), "1,111.55");
opt = new OtcFormatOption
{
grouping = true,
rounded = true,
precision = 2
};
Assert.AreEqual(opt.Format(1111.55555), "1,111.56");
opt = new OtcFormatOption
{
grouping = true,
rounded = true,
precision = 0
};
Assert.AreEqual(opt.Format(1111.55555), "1,112");
}
}
}