54 lines
1.2 KiB
C#
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");
|
|
}
|
|
}
|
|
}
|