Skip to content

Commit 3788fbb

Browse files
committed
Update PlcTranslator resource loading and add test docs
Refactored PlcTranslator to pass both resource type and assembly to SetLocalizationResource, improving localization resource resolution. Added comments in integration test files to document relevant file paths for traceability; no changes to test logic.
1 parent 1282168 commit 3788fbb

4 files changed

Lines changed: 17 additions & 9 deletions

File tree

src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/Integration.Cs/IxProjectTests.IntegrationCs.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515

1616
namespace AXSharp.CompilerTests.Integration.Cs;
1717

18+
/*
19+
* C:\W\Develop\gh\inxton\simatic-ax\axsharp\src\AXSharp.compiler\tests\AXSharp.Compiler.CsTests\bin\Debug\net10.0\samples\units\samples\units\ix
20+
* C:\W\Develop\gh\inxton\simatic-ax\axsharp\src\AXSharp.compiler\tests\AXSharp.Compiler.CsTests\samples\units\expected
21+
*/
1822
public class IxProjectTestsAx : IxProjectTests
1923
{
2024

@@ -226,6 +230,10 @@ public void should_generate_all_even_when_fails_somewhere()
226230
[Fact]
227231
public void should_retrieve_dependencies_and_use_types_from_referenced_project()
228232
{
233+
/*
234+
* C:\W\Develop\gh\inxton\simatic-ax\axsharp\src\AXSharp.compiler\tests\integration\actual\app\samples\units\ix\ax\.g
235+
* C:\W\Develop\gh\inxton\simatic-ax\axsharp\src\AXSharp.compiler\tests\integration\expected\app\ix\.g
236+
*/
229237
var integrationProjectsPaths = new string[]
230238
{
231239
Path.GetFullPath(Path.Combine(testFolder, @"..\..\..\..\integration\actual\lib1")),

src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/PlcResources.g.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ public static PlcTranslator Instance
1818

1919
private PlcTranslator()
2020
{
21-
var defaultResourceType = Assembly.GetAssembly(typeof(units.PlcTranslator))
22-
.GetType("units.Resources.PlcStringResources");
23-
this.SetLocalizationResource(defaultResourceType);
21+
var assembly = Assembly.GetAssembly(typeof(units.PlcTranslator));
22+
var resource = assembly.GetType("units.Resources.PlcStringResources");
23+
this.SetLocalizationResource(resource, assembly);
2424
}
2525
}
2626
}

src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/PlcResources.g.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ public static PlcTranslator Instance
1818

1919
private PlcTranslator()
2020
{
21-
var defaultResourceType = Assembly.GetAssembly(typeof(units.PlcTranslator))
22-
.GetType("units.Resources.PlcStringResources");
23-
this.SetLocalizationResource(defaultResourceType);
21+
var assembly = Assembly.GetAssembly(typeof(units.PlcTranslator));
22+
var resource = assembly.GetType("units.Resources.PlcStringResources");
23+
this.SetLocalizationResource(resource, assembly);
2424
}
2525
}
2626
}

src/AXSharp.compiler/tests/integration/expected/app/ix/.g/PlcResources.g.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ public static PlcTranslator Instance
1818

1919
private PlcTranslator()
2020
{
21-
var defaultResourceType = Assembly.GetAssembly(typeof(app.PlcTranslator))
22-
.GetType("app.Resources.PlcStringResources");
23-
this.SetLocalizationResource(defaultResourceType);
21+
var assembly = Assembly.GetAssembly(typeof(app.PlcTranslator));
22+
var resource = assembly.GetType("app.Resources.PlcStringResources");
23+
this.SetLocalizationResource(resource, assembly);
2424
}
2525
}
2626
}

0 commit comments

Comments
 (0)