using Xunit; using QuantEngine.Core.Domain; namespace QuantEngine.Core.Tests { public class SellPriceSanityCheckerTests { [Fact] public void CheckSellPriceSanity_ValidPrice_Passes() { var res = SellPriceSanityChecker.CheckSellPriceSanity( sellLimitPrice: 100000, stopLossPrice: 95000, prevClose: 100000, ticker: "005930" ); Assert.Equal("PASS", res.SellPriceSanityStatus); Assert.True(res.HtsAllowed); Assert.False(res.ShadowLedger); Assert.Empty(res.SellPriceSanityIssues); } [Fact] public void CheckSellPriceSanity_PriceInversion_Fails() { // sell < stop -> inversion var res = SellPriceSanityChecker.CheckSellPriceSanity( sellLimitPrice: 90000, stopLossPrice: 95000, prevClose: 100000, ticker: "005930" ); Assert.Equal("INVALID_PRICE_INVERSION", res.SellPriceSanityStatus); Assert.False(res.HtsAllowed); Assert.True(res.ShadowLedger); Assert.Contains("INVALID_PRICE_INVERSION", res.SellPriceSanityIssues[0]); } [Fact] public void CheckSellPriceSanity_UnrealisticPrice_Fails() { // sell > prevClose * 1.30 -> unrealistic var res = SellPriceSanityChecker.CheckSellPriceSanity( sellLimitPrice: 140000, stopLossPrice: 95000, prevClose: 100000, ticker: "005930" ); Assert.Equal("INVALID_UNREALISTIC_PRICE", res.SellPriceSanityStatus); Assert.False(res.HtsAllowed); Assert.True(res.ShadowLedger); Assert.Contains("INVALID_UNREALISTIC_PRICE", res.SellPriceSanityIssues[0]); } [Fact] public void CheckSellPriceSanity_InvalidTick_Fails() { // 100005 % 100 != 0 (10만 원대 호가단위 100) -> invalid tick var res = SellPriceSanityChecker.CheckSellPriceSanity( sellLimitPrice: 100005, stopLossPrice: 95000, prevClose: 100000, ticker: "005930" ); Assert.Equal("INVALID_TICK", res.SellPriceSanityStatus); Assert.False(res.HtsAllowed); Assert.True(res.ShadowLedger); Assert.Contains("INVALID_TICK", res.SellPriceSanityIssues[0]); } } }