레거시 서식생성기(VB.NET WinForms) 대체용 C#/.NET 10 WPF 디자이너. 기준선: 실DB 활성 디자인 1,271건 왕복 의미론 diff 0 / 예외 0, 단위 테스트 49/49. 이 커밋에 함께 포함된 자격증명 분리: - appsettings.json 을 __HOST__/__PASSWORD__ 플레이스홀더로 전환 - 실접속 정보는 appsettings.Development.json 으로 분리(.gitignore 제외, csproj Debug 조건부 복사라 Release 산출물에 실리지 않음) - ConfigLoader 를 환경변수 > Development > appsettings 순 레이어링으로 변경, 미치환 플레이스홀더는 '미설정'으로 간주 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
72 lines
2.9 KiB
C#
72 lines
2.9 KiB
C#
using SheetMe.Data.Stores;
|
|
|
|
namespace SheetMe.Core.Tests;
|
|
|
|
/// <summary>E_SctMst 트리 순회(레거시 bzSaveSheetDesignNControlInfo 이식) 테스트.</summary>
|
|
[TestClass]
|
|
public sealed class SctMstXmlWalkerTests
|
|
{
|
|
private static string SamplePath
|
|
=> Path.Combine(AppContext.BaseDirectory, "Assets", "sheetdesign_sample.xml");
|
|
|
|
/// <summary>알파벳 시퀀스 — 레거시 GetNextAlphabetSequence 와 동일</summary>
|
|
[TestMethod]
|
|
[DataRow("A", "B")]
|
|
[DataRow("Y", "Z")]
|
|
[DataRow("Z", "AA")]
|
|
[DataRow("AA", "AB")]
|
|
[DataRow("AZ", "BA")]
|
|
[DataRow("ZZ", "AAA")]
|
|
[DataRow("AAZ", "ABA")]
|
|
public void NextAlphabetSequence_MatchesLegacy(string current, string expected)
|
|
{
|
|
Assert.AreEqual(expected, SctMstXmlWalker.NextAlphabetSequence(current));
|
|
}
|
|
|
|
/// <summary>실샘플 순회 — 전체 Object 수(118)와 루트/자식 규약</summary>
|
|
[TestMethod]
|
|
public void Walk_RealSample_ProducesLegacyRows()
|
|
{
|
|
var rows = SctMstXmlWalker.Walk(File.ReadAllText(SamplePath));
|
|
|
|
Assert.AreEqual(118, rows.Count, "루트(MDesignerHost) 포함 118행이어야 합니다.");
|
|
|
|
var root = rows[0];
|
|
Assert.AreEqual("MDesignerHost1", root.ObjName);
|
|
Assert.AreEqual("A".PadRight(15), root.ObjId);
|
|
Assert.AreEqual("M.EMR.UserControl.MDesignerHost", root.ObjType);
|
|
Assert.AreEqual(string.Empty.PadRight(15), root.ParentId);
|
|
|
|
// 첫 자식: ObjId = AAA...? 루트 A 의 첫 자식 = A + AA = "AAA"? 아님 — 부모ID+AA = "AAA" 가 아니라 "A"+"AA"="AAA"
|
|
var firstChild = rows[1];
|
|
Assert.AreEqual("AAA".PadRight(15), firstChild.ObjId, "루트 A 의 첫 자식은 A+AA=AAA");
|
|
Assert.AreEqual("A".PadRight(15), firstChild.ParentId);
|
|
|
|
// 모든 행의 ObjId 는 15자 패딩
|
|
Assert.IsTrue(rows.All(r => r.ObjId.Length == 15));
|
|
// ObjType 은 AQN 이 아니라 풀 클래스명(콤마 없음)
|
|
Assert.IsTrue(rows.All(r => !r.ObjType.Contains(',')));
|
|
}
|
|
|
|
/// <summary>Text Property 가 SctObjTxt 로 추출되는지</summary>
|
|
[TestMethod]
|
|
public void Walk_ExtractsText()
|
|
{
|
|
const string xml =
|
|
"<Sheet name=\"SheetDesignInfo\">" +
|
|
"<Object type=\"M.EMR.UserControl.MDesignerHost, M.EMR.UserControl\" name=\"MDesignerHost1\" children=\"Controls\" DisplaySequence=\"0\">" +
|
|
"<Object type=\"M.EMR.UserControl.Label, M.EMR.UserControl\" name=\"lbl1\" children=\"Controls\" DisplaySequence=\"3\">" +
|
|
"<Property name=\"Text\">제목입니다</Property>" +
|
|
"</Object>" +
|
|
"</Object>" +
|
|
"</Sheet>";
|
|
|
|
var rows = SctMstXmlWalker.Walk(xml);
|
|
|
|
Assert.AreEqual(2, rows.Count);
|
|
Assert.AreEqual("제목입니다", rows[1].ObjText);
|
|
Assert.AreEqual("3", rows[1].ObjSeq);
|
|
Assert.AreEqual("M.EMR.UserControl.Label", rows[1].ObjType);
|
|
}
|
|
}
|