using Infrastructure.StockData; namespace Application.Tests; [TestClass] public sealed class SeibroStkListParserTests { [TestMethod] public void Parse_FromSampleXml_MapsCirclForms() { // SEIBro getStkListInfo 실응답 fixture (2018-12 유통형태변경) — 다수 행. 변경전/후 유통형태 코드 + 적용일. var rows = SeibroStkListParser.Parse(SeibroXml.Parse(SeibroFixtures.Read("getStkListInfo.xml"))); Assert.IsTrue(rows.Count >= 100, "표본 행 다수"); var etf = rows.Single(c => c.Isin == "KR7314700006"); Assert.AreEqual("314700", etf.ShotnIsin); Assert.AreEqual("211", etf.BfaltCirclForm, "변경전 예탁지정"); Assert.AreEqual("110", etf.AfaltCirclForm, "변경후 유가"); Assert.AreEqual(new DateOnly(2018, 12, 21), etf.ApliDt); // 신규 등록: 변경전 유통형태 빈값 → null var newlyListed = rows.Single(c => c.Isin == "KR7313150005"); Assert.IsNull(newlyListed.BfaltCirclForm, "BFALT value=\"\" → null"); Assert.AreEqual("241", newlyListed.AfaltCirclForm, "변경후 권리"); } [TestMethod] public void Parse_SkipsRow_WhenApliDtMissing() { // 기대 행위: 적용일 없으면 건너뛴다 const string xml = """ """; var rows = SeibroStkListParser.Parse(SeibroXml.Parse(xml)); Assert.AreEqual(1, rows.Count); Assert.AreEqual("KR7000000002", rows[0].Isin); Assert.AreEqual(10, rows[0].IssucoCustno); Assert.AreEqual(new DateOnly(2020, 3, 15), rows[0].ApliDt); } }