using Xunit; using QuantEngine.Core.Domain; namespace QuantEngine.Core.Tests { public class KrxTickNormalizerTests { [Theory] [InlineData(1500, 1)] // < 2000 [InlineData(4500, 5)] // < 5000 [InlineData(15000, 10)] // < 20000 [InlineData(45000, 50)] // < 50000 [InlineData(150000, 100)] // < 200000 [InlineData(450000, 500)] // < 500000 [InlineData(1000000, 1000)]// >= 500000 public void GetTickUnit_PriceRanges_ReturnExpectedTick(double price, int expectedTick) { int tick = KrxTickNormalizer.GetTickUnit(price); Assert.Equal(expectedTick, tick); } [Theory] [InlineData(1500.3, 1500)] // remainder = 0.3 < 0.5 -> round down [InlineData(1500.7, 1501)] // remainder = 0.7 >= 0.5 -> round up [InlineData(4502, 4500)] // tick = 5, remainder = 2 < 2.5 -> round down [InlineData(4503, 4505)] // tick = 5, remainder = 3 >= 2.5 -> round up public void NormalizeTick_VariousPrices_ReturnNormalizedPrice(double price, double expectedNormalized) { double res = KrxTickNormalizer.NormalizeTick(price); Assert.Equal(expectedNormalized, res); } } }