From 5d0c21388b3e6137089c348796c84a988a52b334 Mon Sep 17 00:00:00 2001 From: Alex Zaytsev Date: Thu, 27 Jun 2024 18:31:27 +1000 Subject: [PATCH] Add test --- .../GKTests/GDModel/GDMLocationRecordTests.cs | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/projects/GKTests/GDModel/GDMLocationRecordTests.cs b/projects/GKTests/GDModel/GDMLocationRecordTests.cs index b84018743..99e5bcbf8 100644 --- a/projects/GKTests/GDModel/GDMLocationRecordTests.cs +++ b/projects/GKTests/GDModel/GDMLocationRecordTests.cs @@ -439,6 +439,32 @@ public void Test_Carbuna2() "'28.08.1991 [G] >': 'Молдова, Карбуна'" , result); } + [Test] + public void Test_Carbuna3() + { + var tree = new GDMTree(); + var ussr = tree.CreateLocation(); + ussr.AddLocName("СССР", "FROM 30 DEC 1922 TO 26 DEC 1991"); + + var moldova = tree.CreateLocation(); + moldova.AddLocName("Молдова", "FROM 28 AUG 1991"); + moldova.AddLocName("Молдавская ССР", "FROM 2 AUG 1940 TO 27 AUG 1991"); + moldova.AddLocLink(ussr, "FROM 2 AUG 1940 TO 27 AUG 1991"); + + var carbuna = tree.CreateLocation(); + carbuna.AddLocName("Карбуна", "FROM 1775"); + carbuna.AddLocLink(moldova, "FROM 2 AUG 1940 TO 1995"); + + var names = carbuna.GetFullNames(tree, ATDEnumeration.fLtS); + var result = string.Join("\n", names.OrderBy(x => x.Date).Select(x => string.Format("'{0}': '{1}'", x.Date.ToString(), x.StringValue))); + + Assert.AreEqual( + "'__.__.1775 [G] - 01.08.1940 [G]': 'Карбуна'\n" + + "'02.08.1940 [G] - 27.08.1991 [G]': 'СССР, Молдавская ССР, Карбуна'\n" + + "'28.08.1991 [G] - __.__.1995 [G]': 'Молдова, Карбуна'\n" + + "'__.__.1995 [G] > ': 'Карбуна'" + , result); + } [Test] public void Test_DateIntersections()